diff options
author | james-jra <james.andrew@metaswitch.com> | 2018-05-25 18:00:11 +0100 |
---|---|---|
committer | Adam Miller <admiller@redhat.com> | 2018-05-25 12:00:11 -0500 |
commit | 4a6161bab8d1fa960e3cc401108834d0b2c4ca0f (patch) | |
tree | 594b97e4a96adb110a4a3d30d2a314280e53941f | |
parent | b7b19d139e910da4445c4fa0aa39d04f59f58b3c (diff) | |
download | ansible-4a6161bab8d1fa960e3cc401108834d0b2c4ca0f.tar.gz |
Create a new pipe for sshpass on final retry. Fixes #32238 (#39294)
-rw-r--r-- | lib/ansible/plugins/connection/ssh.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/ansible/plugins/connection/ssh.py b/lib/ansible/plugins/connection/ssh.py index 144de68040..6db91eccd3 100644 --- a/lib/ansible/plugins/connection/ssh.py +++ b/lib/ansible/plugins/connection/ssh.py @@ -279,6 +279,11 @@ def _ssh_retry(func): # 255 = failure from the ssh command itself except (AnsibleControlPersistBrokenPipeError) as e: # Retry one more time because of the ControlPersist broken pipe (see #16731) + cmd = args[0] + if self._play_context.password and isinstance(cmd, list): + # This is a retry, so 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') display.vvv(u"RETRYING BECAUSE OF CONTROLPERSIST BROKEN PIPE") return_tuple = func(self, *args, **kwargs) |