From 0118bf0cb9256637684db3f18cbd012d3851065e Mon Sep 17 00:00:00 2001 From: Robert Rettig Date: Thu, 24 Jun 2021 23:37:48 +0200 Subject: [PATCH 1/3] fixes #24 and #190 --- plugins/modules/synchronize.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/modules/synchronize.py b/plugins/modules/synchronize.py index 2676275..743deec 100644 --- a/plugins/modules/synchronize.py +++ b/plugins/modules/synchronize.py @@ -548,10 +548,10 @@ def main(): ssh_cmd_str = ' '.join(shlex_quote(arg) for arg in ssh_cmd) if ssh_args: ssh_cmd_str += ' %s' % ssh_args - cmd.append('--rsh=%s' % ssh_cmd_str) + cmd.append(shlex_quote('--rsh=%s' % ssh_cmd_str)) if rsync_path: - cmd.append('--rsync-path=%s' % rsync_path) + cmd.append(shlex_quote('--rsync-path=%s' % rsync_path)) if rsync_opts: if '' in rsync_opts: @@ -577,7 +577,7 @@ def main(): cmd.append('--link-dest=%s' % link_path) changed_marker = '<>' - cmd.append('--out-format=' + changed_marker + '%i %n%L') + cmd.append(shlex_quote('--out-format=' + changed_marker + '%i %n%L')) # expand the paths if '@' not in source: @@ -601,10 +601,10 @@ def main(): raise (rc, out, err) = module.run_command( - cmd, pass_fds=_sshpass_pipe, + cmdstr, pass_fds=_sshpass_pipe, before_communicate_callback=_write_password_to_pipe) else: - (rc, out, err) = module.run_command(cmd) + (rc, out, err) = module.run_command(cmdstr) if rc: return module.fail_json(msg=err, rc=rc, cmd=cmdstr) From 9f384c00a3e37ccc4bf16dc33bddfa7367791f6b Mon Sep 17 00:00:00 2001 From: Robert Rettig Date: Thu, 24 Jun 2021 23:58:28 +0200 Subject: [PATCH 2/3] add changelog fragment --- changelogs/fragments/213_quote_cmd_args.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelogs/fragments/213_quote_cmd_args.yml diff --git a/changelogs/fragments/213_quote_cmd_args.yml b/changelogs/fragments/213_quote_cmd_args.yml new file mode 100644 index 0000000..e669d41 --- /dev/null +++ b/changelogs/fragments/213_quote_cmd_args.yml @@ -0,0 +1,4 @@ +--- +bugfixes: +- Synchronize module not recognizing remote ssh key (https://github.com/ansible-collections/ansible.posix/issues/24). +- Synchronize not using quotes around arguments like --out-format (https://github.com/ansible-collections/ansible.posix/issues/190). From 25cfc56f6f5cc857699efdfc1b99df8949647c86 Mon Sep 17 00:00:00 2001 From: Robert Rettig Date: Fri, 9 Jul 2021 02:28:39 +0200 Subject: [PATCH 3/3] enable integration tests ansible-collections/ansible.posix/pull/213#issuecomment-876480707 --- tests/integration/targets/synchronize/aliases | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/integration/targets/synchronize/aliases b/tests/integration/targets/synchronize/aliases index 781048b..a6dafcf 100644 --- a/tests/integration/targets/synchronize/aliases +++ b/tests/integration/targets/synchronize/aliases @@ -1,2 +1 @@ shippable/posix/group1 -disabled # fixme package