summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjctanner <tanner.jc@gmail.com>2016-05-13 13:39:04 -0400
committerJames Tanner <tanner.jc@gmail.com>2016-05-13 13:52:30 -0400
commitb181fe0bc2e8f061b68c6fddd04ac8ac9225db69 (patch)
tree559dad9a7be35f9dc96d59c0c7f7b60926264f2d
parent71c7476199222815f341c6b85291dd969b6eec53 (diff)
downloadansible-b181fe0bc2e8f061b68c6fddd04ac8ac9225db69.tar.gz
Disable sftp batch mode if sshpass (#15829)
Make use of the -oBatchMode=no option to force password prompts from sftp Addresses #13401
-rw-r--r--lib/ansible/plugins/connection/ssh.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/ansible/plugins/connection/ssh.py b/lib/ansible/plugins/connection/ssh.py
index b03b15fc36..06dca813e3 100644
--- a/lib/ansible/plugins/connection/ssh.py
+++ b/lib/ansible/plugins/connection/ssh.py
@@ -133,8 +133,12 @@ class Connection(ConnectionBase):
## Next, additional arguments based on the configuration.
# sftp batch mode allows us to correctly catch failed transfers, but can
- # be disabled if the client side doesn't support the option.
+ # be disabled if the client side doesn't support the option. However,
+ # sftp batch mode does not prompt for passwords so it must be disabled
+ # if not using controlpersist and using sshpass
if binary == 'sftp' and C.DEFAULT_SFTP_BATCH_MODE:
+ if self._play_context.password:
+ self._add_args('disable batch mode for sshpass', ['-o', 'BatchMode=no'])
self._command += ['-b', '-']
self._command += ['-C']