Skip to content

Commit

Permalink
Whitespace in fully qualified path to playbook causes rsync to incorr…
Browse files Browse the repository at this point in the history
…ectly chdir to current source dir

Example :

cd "/home/a/ansible plays"

task:
  - synchronize:
      src: a
      dest: b

Results in the following error being thrown

fatal: [remote-host]: FAILED! => {"changed": false, "cmd": "/usr/bin/rsync --delay-updates -F --compress --archive --rsh='/usr/bin/ssh -S none -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' --rsync-path='sudo -u root rsync' --out-format='<<CHANGED>>%i %n%L' /home/a/ansible plays/deployments// remote-user@remote-host:/data/", "msg": "rsync: [sender] link_stat \"/home/a/ansible\" failed: No such file or directory (2)\nrsync: [sender] change_dir \"/home/a/ansible plays/plays/a/\" failed: No such file or directory (2)\nrsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1330) [sender=3.2.3]\n", "rc": 23}
  • Loading branch information
mikewallisiconsolutions committed Oct 8, 2021
1 parent 8f58cbb commit 8728c16
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/modules/synchronize.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ def main():
if '@' not in dest:
dest = os.path.expanduser(dest)

cmd.append(source)
cmd.append(shlex_quote(source))
cmd.append(dest)
cmdstr = ' '.join(cmd)

Expand Down

0 comments on commit 8728c16

Please sign in to comment.