Disable sftp batch mode if sshpass (#15829)

Make use of the -oBatchMode=no option to force password prompts from sftp

Addresses #13401
This commit is contained in:
jctanner 2016-05-13 13:39:04 -04:00
parent 119baba6b1
commit e083fa3d11

View file

@ -133,8 +133,12 @@ class Connection(ConnectionBase):
## Next, additional arguments based on the configuration. ## Next, additional arguments based on the configuration.
# sftp batch mode allows us to correctly catch failed transfers, but can # 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 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 += ['-b', '-']
self._command += ['-C'] self._command += ['-C']