MCPcopy
hub / github.com/ktbyers/netmiko / exit_enable_mode

Method exit_enable_mode

netmiko/base_connection.py:2075–2093  ·  view source on GitHub ↗

Exit enable mode. :param exit_command: Command that exits the session from privileged mode :type exit_command: str

(self, exit_command: str = "")

Source from the content-addressed store, hash-verified

2073 return output
2074
2075 def exit_enable_mode(self, exit_command: str = "") -> str:
2076 """Exit enable mode.
2077
2078 :param exit_command: Command that exits the session from privileged mode
2079 :type exit_command: str
2080 """
2081 output = ""
2082 if self.check_enable_mode():
2083 self.write_channel(self.normalize_cmd(exit_command))
2084 # Make sure you read until you detect the command echo (avoid getting out of sync)
2085 if self.global_cmd_verify is not False:
2086 output += self.read_until_pattern(pattern=re.escape(exit_command.strip()))
2087 else:
2088 time.sleep(0.3)
2089 output += self.read_channel()
2090 output += self.read_until_prompt()
2091 if self.check_enable_mode():
2092 raise ValueError("Failed to exit enable mode.")
2093 return output
2094
2095 def check_config_mode(
2096 self, check_string: str = "", pattern: str = "", force_regex: bool = False

Callers

nothing calls this directly

Calls 6

check_enable_modeMethod · 0.95
write_channelMethod · 0.95
normalize_cmdMethod · 0.95
read_until_patternMethod · 0.95
read_channelMethod · 0.95
read_until_promptMethod · 0.95

Tested by

no test coverage detected