We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3693cf4 commit 4adb081Copy full SHA for 4adb081
netmiko/checkpoint/checkpoint_gaia_ssh.py
@@ -35,6 +35,18 @@ def session_preparation(self) -> None:
35
time.sleep(0.3 * self.global_delay_factor)
36
self.clear_buffer()
37
38
+ def cleanup(self, command: str = "exit") -> None:
39
+ """Gracefully exit the SSH session."""
40
+ try:
41
+ if self.check_enable_mode():
42
+ self.exit_enable_mode()
43
+ except Exception:
44
+ pass
45
+ # Always try to send final 'exit' (command)
46
+ if self.session_log:
47
+ self.session_log.fin = True
48
+ self.write_channel(command + self.RETURN)
49
+
50
def check_enable_mode(self, check_string: str = "#") -> bool:
51
"""Check if in enable mode. Return boolean."""
52
return super().check_enable_mode(check_string=check_string)
0 commit comments