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
This commit is contained in:
jctanner 2018-03-28 21:45:49 -04:00 committed by Toshio Kuratomi
parent a19a21d715
commit 7ea05a2d56

View file

@ -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)