From e083fa3d1193c886002d286a0b2d210c9657a092 Mon Sep 17 00:00:00 2001 From: jctanner Date: Fri, 13 May 2016 13:39:04 -0400 Subject: [PATCH] Disable sftp batch mode if sshpass (#15829) Make use of the -oBatchMode=no option to force password prompts from sftp Addresses #13401 --- lib/ansible/plugins/connection/ssh.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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']