dedupe the --rsh options in favor of user supplied (#38096)

This commit is contained in:
jctanner 2018-03-29 10:32:27 -04:00 committed by Adam Miller
parent 6f2cb28bb9
commit e10724fadb

View file

@ -462,6 +462,16 @@ def main():
module.fail_json(msg='either src or dest must be a localhost', rc=1) module.fail_json(msg='either src or dest must be a localhost', rc=1)
if is_rsh_needed(source, dest): if is_rsh_needed(source, dest):
# https://github.com/ansible/ansible/issues/15907
has_rsh = False
for rsync_opt in rsync_opts:
if '--rsh' in rsync_opt:
has_rsh = True
break
# if the user has not supplied an --rsh option go ahead and add ours
if not has_rsh:
ssh_cmd = [module.get_bin_path('ssh', required=True), '-S', 'none'] ssh_cmd = [module.get_bin_path('ssh', required=True), '-S', 'none']
if private_key is not None: if private_key is not None:
ssh_cmd.extend(['-i', private_key]) ssh_cmd.extend(['-i', private_key])