minor bug fixes and updates to shell

pull/14439/head
Peter Sprygada 9 years ago
parent 3ddcabee0e
commit 9c36c0aa80

@ -44,6 +44,8 @@ CLI_ERRORS_RE = [
re.compile(r"connection timed out", re.I),
re.compile(r"[^\r\n]+ not found", re.I),
re.compile(r"'[^']' +returned error code: ?\d+"),
re.compile(r"syntax error"),
re.compile(r"unknown command")
]
def to_list(val):
@ -77,6 +79,8 @@ class Shell(object):
self.ssh = None
self.shell = None
self._matched_prompt = None
self.prompts = list()
self.prompts.extend(CLI_PROMPTS_RE)
@ -169,7 +173,9 @@ class Shell(object):
raise ShellError('%s' % response)
for regex in self.prompts:
if regex.search(response):
match = regex.search(response)
if match:
self._matched_prompt = match.group()
return True
def get_cli_connection(module):

Loading…
Cancel
Save