1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Revert "Quote ssh_args"

This reverts commit a9c3a452f0.
This commit is contained in:
Toshio Kuratomi 2017-03-24 09:17:55 -07:00
parent a9c3a452f0
commit 65d9feea4f

View file

@ -310,19 +310,6 @@ EXAMPLES = '''
- "--no-motd" - "--no-motd"
- "--exclude=.git" - "--exclude=.git"
''' '''
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
client_addr = None client_addr = None
@ -475,7 +462,7 @@ def main():
ssh_opts = '%s -o StrictHostKeyChecking=no' % ssh_opts ssh_opts = '%s -o StrictHostKeyChecking=no' % ssh_opts
if ssh_args: if ssh_args:
ssh_opts = '%s %s' % (ssh_opts, shlex_quote(ssh_args)) ssh_opts = '%s %s' % (ssh_opts, ssh_args)
if source.startswith('"rsync://') and dest.startswith('"rsync://'): if source.startswith('"rsync://') and dest.startswith('"rsync://'):
module.fail_json(msg='either src or dest must be a localhost', rc=1) module.fail_json(msg='either src or dest must be a localhost', rc=1)
@ -485,9 +472,9 @@ def main():
# Note: The action plugin takes care of setting this to a port from # Note: The action plugin takes care of setting this to a port from
# inventory if the user didn't specify an explicit dest_port # inventory if the user didn't specify an explicit dest_port
if dest_port is not None: if dest_port is not None:
cmd += " --rsh '%s %s %s -o Port=%s'" % (ssh, private_key, ssh_opts, dest_port) cmd += " --rsh 'ssh %s %s -o Port=%s'" % (private_key, ssh_opts, dest_port)
else: else:
cmd += " --rsh '%s %s %s'" % (ssh, private_key, ssh_opts) cmd += " --rsh 'ssh %s %s'" % (private_key, ssh_opts)
if rsync_path: if rsync_path:
cmd = cmd + " --rsync-path=%s" % (rsync_path) cmd = cmd + " --rsync-path=%s" % (rsync_path)
@ -527,6 +514,8 @@ def main():
return module.exit_json(changed=changed, msg=out_clean, return module.exit_json(changed=changed, msg=out_clean,
rc=rc, cmd=cmdstr, stdout_lines=out_lines) rc=rc, cmd=cmdstr, stdout_lines=out_lines)
# import module snippets
from ansible.module_utils.basic import *
if __name__ == '__main__': if __name__ == '__main__':
main() main()