minor bug fixes and updates to shell

stable-2.0-network
Peter Sprygada 9 years ago
parent d178c4be2a
commit 1fd5bcdc09

@ -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)
@ -166,7 +170,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