Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update f5_tmsh_ssh.py fixed "quit" #3403

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

tramontano
Copy link
Contributor

Fixed "quit" closing session command, nothing is expected since the session is terminated immediately.

Fixed "quit" closing session command, nothing is expected since the session is terminated immediately.
@@ -22,7 +22,7 @@ def tmsh_mode(self, delay_factor: float = 1.0) -> str:
return output

def exit_tmsh(self) -> str:
output = self._send_command_str("quit", expect_string=r"#")
output = self._send_command_str("quit", expect_string=r"")
Copy link
Owner

@ktbyers ktbyers Mar 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A null expect string is not valid/correct (i.e. should do a write_channel() instead)

Also it looks like whether quit causes the SSH to terminate depends:

You can exit tmsh by entering quit. Two different results may occur, depending on the 
user's terminal access type:

If you are granted bash access, you will be returned to bash.
If you are granted tmsh access, you will be logged out of the BIG-IP system.

From https://my.f5.com/manage/s/article/K12029#:~:text=You%20can%20exit%20tmsh%20by,will%20be%20returned%20to%20bash.

So we would probably need to handle both cases (likely via a try/except block).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants