Exit enable mode. :param exit_command: Command that exits the session from privileged mode :type exit_command: str
(self, exit_command: str = "")
| 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 |
nothing calls this directly
no test coverage detected