summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToshio Kuratomi <toshio@fedoraproject.org>2016-01-26 09:43:38 -0800
committerToshio Kuratomi <toshio@fedoraproject.org>2016-01-26 09:43:38 -0800
commitcb1fefdf92a9ee14558d3e0caf60fcc3b9c2c39a (patch)
treed470deff98b94c8d6b97dd6be2d64e2ea41ec85d
parent25414bbd1b28241a029a9f8875fc6349b090fc2d (diff)
downloadansible-modules-core-synchronize-better-error-missing-rsync.tar.gz
Better error message when rsync nad ssh aren't present where synchronize is runsynchronize-better-error-missing-rsync
Fixes https://github.com/ansible/ansible/issues/9305
-rw-r--r--files/synchronize.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/files/synchronize.py b/files/synchronize.py
index fd1d5633..eab051d0 100644
--- a/files/synchronize.py
+++ b/files/synchronize.py
@@ -325,6 +325,11 @@ def main():
ssh_args = module.params['ssh_args']
verify_host = module.params['verify_host']
+ if '/' not in rsync:
+ rsync = module.get_bin_path(rsync, required=True)
+
+ ssh = module.get_bin_path('ssh', required=True)
+
cmd = '%s --delay-updates -F' % rsync
if compress:
cmd = cmd + ' --compress'
@@ -385,9 +390,9 @@ def main():
ssh_opts = '%s %s' % (ssh_opts, ssh_args)
if dest_port != 22:
- cmd += " --rsh 'ssh %s %s -o Port=%s'" % (private_key, ssh_opts, dest_port)
+ cmd += " --rsh '%s %s %s -o Port=%s'" % (ssh, private_key, ssh_opts, dest_port)
else:
- cmd += " --rsh 'ssh %s %s'" % (private_key, ssh_opts) # need ssh param
+ cmd += " --rsh '%s %s %s'" % (ssh, private_key, ssh_opts) # need ssh param
if rsync_path:
cmd = cmd + " --rsync-path=%s" % (rsync_path)