Commit b2dc66c7 by Brian Coca

now check stderr also on become for ssh plugin for the cases where sudo or su do…

now check stderr also on become for ssh plugin for the cases where sudo or su do not want to prompt/echo on stdin
fixes #11796
parent 17f659a1
...@@ -377,7 +377,7 @@ class Connection(ConnectionBase): ...@@ -377,7 +377,7 @@ class Connection(ConnectionBase):
become_errput = '' become_errput = ''
while True: while True:
self._display.debug('Waiting for Privilege Escalation input') self._display.debug('Waiting for Privilege Escalation input')
if self.check_become_success(become_output) or self.check_password_prompt(become_output): if self.check_become_success(become_output + become_errput) or self.check_password_prompt(become_output + become_errput):
break break
rfd, wfd, efd = select.select([p.stdout, p.stderr], [], [p.stdout], self._play_context.timeout) rfd, wfd, efd = select.select([p.stdout, p.stderr], [], [p.stdout], self._play_context.timeout)
...@@ -398,7 +398,7 @@ class Connection(ConnectionBase): ...@@ -398,7 +398,7 @@ class Connection(ConnectionBase):
if not chunk: if not chunk:
raise AnsibleError('Connection closed waiting for privilege escalation password prompt: %s ' % become_output) raise AnsibleError('Connection closed waiting for privilege escalation password prompt: %s ' % become_output)
if not self.check_become_success(become_output): if not self.check_become_success(become_output + become_errput):
self._display.debug("Sending privilege escalation password.") self._display.debug("Sending privilege escalation password.")
stdin.write(self._play_context.become_pass + '\n') stdin.write(self._play_context.become_pass + '\n')
else: else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment