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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion netmiko/f5/f5_tmsh_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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).

self.set_base_prompt()
return output

Expand Down
Loading