diff options
author | Matt Martz <matt@sivel.net> | 2017-09-07 12:15:31 -0500 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2017-09-11 08:49:56 -0700 |
commit | b8e02b0dc116bd6b97e3092ffe420acfd148cd9d (patch) | |
tree | 5b114893983924d5ac18ce8c624bb577d7d63f3a /lib | |
parent | 09d38049eb356a3fc7c1f086f5c81dd994fae833 (diff) | |
download | ansible-b8e02b0dc116bd6b97e3092ffe420acfd148cd9d.tar.gz |
Create a new pipe for sshpass on retries. Fixes #29095
(cherry picked from commit d043ba2673d20eb84b2d1d895c0e8033ec9b303e)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ansible/plugins/connection/ssh.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/ansible/plugins/connection/ssh.py b/lib/ansible/plugins/connection/ssh.py index ee0c1f67a0..fbbdef1d05 100644 --- a/lib/ansible/plugins/connection/ssh.py +++ b/lib/ansible/plugins/connection/ssh.py @@ -72,6 +72,12 @@ def _ssh_retry(func): remaining_tries = int(C.ANSIBLE_SSH_RETRIES) + 1 cmd_summary = "%s..." % args[0] for attempt in range(remaining_tries): + cmd = args[0] + if attempt != 0 and self._play_context.password and isinstance(cmd, list): + # If this is a retry, the fd/pipe for sshpass is closed, and we need a new one + self.sshpass_pipe = os.pipe() + cmd[1] = b'-d' + to_bytes(self.sshpass_pipe[0], nonstring='simplerepr', errors='surrogate_or_strict') + try: try: return_tuple = func(self, *args, **kwargs) |