mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00: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:
committed by
John R Barker
parent
d3d1aa2dca
commit
4cbbed0b37
@@ -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 """
|
||||
|
||||
Reference in New Issue
Block a user