Skip to content

Commit

Permalink
Prompt modifyed for MikroTik
Browse files Browse the repository at this point in the history
Prompt regex for MikroTik generates so it matches only if prompt string is found in the end of string (no more printable symbols were printed after it).
  • Loading branch information
Tonygratta committed Jul 26, 2024
1 parent ace6062 commit 028f887
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions netmiko/mikrotik/mikrotik_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@ def disable_paging(self, *args: Any, **kwargs: Any) -> str:
"""Mikrotik does not have paging by default."""
return ""

def _prompt_handler(self, auto_find_prompt: bool) -> str:
"""Prompt regex for MikroTik generates so it matches
only if prompt string is found in the end of string
(no more printable symbols were printed after it)
"""
if auto_find_prompt:
try:
prompt = self.find_prompt()
except ValueError:
prompt = self.base_prompt
else:
prompt = self.base_prompt
return re.escape(prompt.strip()) + r"[ \t]*$"

def strip_prompt(self, a_string: str) -> str:
"""Strip the trailing router prompt from the output.
Expand Down

0 comments on commit 028f887

Please sign in to comment.