1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

minor bug fixes and updates to shell

This commit is contained in:
Peter Sprygada 2016-02-11 07:11:36 -05:00
parent 3ddcabee0e
commit 9c36c0aa80

View file

@ -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):