mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Fix password prompt matching (#24081)
* Fix password prompt matching * Add some tests for check_password_prompt * Prevent pep8 line ends with a space error
This commit is contained in:
@@ -254,10 +254,8 @@ class ConnectionBase(with_metaclass(ABCMeta, object)):
|
||||
return False
|
||||
elif isinstance(self._play_context.prompt, string_types):
|
||||
b_prompt = to_bytes(self._play_context.prompt).strip()
|
||||
b_lines = b_output.splitlines(True)
|
||||
if not b_lines:
|
||||
return False
|
||||
return b_lines[-1].strip().endswith(b_prompt) or b_lines[0].strip().endswith(b_prompt)
|
||||
b_lines = b_output.splitlines()
|
||||
return any(l.strip().startswith(b_prompt) for l in b_lines)
|
||||
else:
|
||||
return self._play_context.prompt(b_output)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user