mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-09 17:59:09 -07:00
fixes issue with prompt detection in network_cli (#21574)
The network_cli plugin would return immediately if an error was detected. This patch will force the connection plugin to still try to detect the current prompt even if an error is found.
This commit is contained in:
parent
d3d1aa2dca
commit
4cbbed0b37
2 changed files with 16 additions and 13 deletions
|
@ -193,16 +193,22 @@ class Connection(_Connection):
|
|||
|
||||
def _find_prompt(self, response):
|
||||
"""Searches the buffered response for a matching command prompt"""
|
||||
errored_response = None
|
||||
for regex in self._terminal.terminal_errors_re:
|
||||
if regex.search(response):
|
||||
raise AnsibleConnectionFailure(response)
|
||||
errored_response = response
|
||||
break
|
||||
|
||||
for regex in self._terminal.terminal_prompts_re:
|
||||
match = regex.search(response)
|
||||
if match:
|
||||
self._matched_pattern = regex.pattern
|
||||
self._matched_prompt = match.group()
|
||||
return True
|
||||
if not errored_response:
|
||||
return True
|
||||
|
||||
if errored_response:
|
||||
raise AnsibleConnectionFailure(errored_response)
|
||||
|
||||
def alarm_handler(self, signum, frame):
|
||||
"""Alarm handler raised in case of command timeout """
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue