mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-02 00:33:09 +00:00
Split on newlines when checking for prompt matches (#20945)
* Check for the prompt as a substring of the output sudo sometimes spits out warnings to stdout before getting to the password prompt. Account for that when trying to match a password prompt. Fixes #20858
This commit is contained in:
@@ -254,7 +254,7 @@ class ConnectionBase(with_metaclass(ABCMeta, object)):
|
|||||||
return False
|
return False
|
||||||
elif isinstance(self._play_context.prompt, string_types):
|
elif isinstance(self._play_context.prompt, string_types):
|
||||||
b_prompt = to_bytes(self._play_context.prompt)
|
b_prompt = to_bytes(self._play_context.prompt)
|
||||||
return b_output.startswith(b_prompt)
|
return b_prompt in b_output
|
||||||
else:
|
else:
|
||||||
return self._play_context.prompt(b_output)
|
return self._play_context.prompt(b_output)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user