-
-
Save jimi-c/58a45c314841b0c2392b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/ansible/plugins/connections/ssh.py b/lib/ansible/plugins/connections/ssh.py | |
index 5b2ed99..1b553b4 100644 | |
--- a/lib/ansible/plugins/connections/ssh.py | |
+++ b/lib/ansible/plugins/connections/ssh.py | |
@@ -360,14 +360,6 @@ class Connection(ConnectionBase): | |
display_cmd = map(pipes.quote, cmd[:-1]) + [cmd[-1]] | |
self._display.vvv('SSH: EXEC {0}'.format(' '.join(display_cmd)), host=self.host) | |
- # We begin by acquiring the connection lock, so that if ssh issues a | |
- # host key verification prompt, output from other connections doesn't | |
- # obscure it. The lock can be released once we know that the host key | |
- # has been accepted (either because of known_hosts or the prompt). | |
- | |
- self.connection_lock() | |
- self._unlocked = False | |
- | |
# Start the given command. If we don't need to pipeline data, we can try | |
# to use a pseudo-tty (ssh will have been invoked with -tt). If we are | |
# pipelining data, or can't create a pty, we fall back to using plain | |
@@ -388,6 +380,14 @@ class Connection(ConnectionBase): | |
p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
stdin = p.stdin | |
+ # We begin by acquiring the connection lock, so that if ssh issues a | |
+ # host key verification prompt, output from other connections doesn't | |
+ # obscure it. The lock can be released once we know that the host key | |
+ # has been accepted (either because of known_hosts or the prompt). | |
+ | |
+ self.connection_lock() | |
+ self._unlocked = False | |
+ | |
# If we are using SSH password authentication, write the password into | |
# the pipe we opened in _build_command. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment