From 7ea05a2d56805ceca2a94510c84f4bb909b2705b Mon Sep 17 00:00:00 2001 From: jctanner Date: Wed, 28 Mar 2018 21:45:49 -0400 Subject: [PATCH] synchronize: fix the mixture of quoting and passing of lists to run_command (#38020) * switch to six.moves.shlex_quote * remove the unncessary quotes on rsh --- lib/ansible/modules/files/synchronize.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/ansible/modules/files/synchronize.py b/lib/ansible/modules/files/synchronize.py index 8a43f17b90..1fe647fc17 100644 --- a/lib/ansible/modules/files/synchronize.py +++ b/lib/ansible/modules/files/synchronize.py @@ -306,14 +306,8 @@ EXAMPLES = ''' import os -# Python3 compat. six.moves.shlex_quote will be available once we're free to -# upgrade beyond six-1.4 module-side. -try: - from shlex import quote as shlex_quote -except ImportError: - from pipes import quote as shlex_quote - from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.six.moves import shlex_quote client_addr = None @@ -481,7 +475,7 @@ 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('--rsh=%s' % ssh_cmd_str) if rsync_path: cmd.append('--rsync-path=%s' % rsync_path)