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

A very simple fix to enable spaces in the files sent via the copy module.

This commit is contained in:
Michael DeHaan 2013-03-11 17:11:53 -04:00
parent 4eaca08664
commit 6e2ea327d1
2 changed files with 5 additions and 4 deletions

View file

@ -629,8 +629,8 @@ class AnsibleModule(object):
for x in items: for x in items:
try: try:
(k, v) = x.split("=",1) (k, v) = x.split("=",1)
except: except Exception, e:
self.fail_json(msg="this module requires key=value arguments") self.fail_json(msg="this module requires key=value arguments (%s)" % items)
params[k] = v params[k] = v
params2 = json.loads(MODULE_COMPLEX_ARGS) params2 = json.loads(MODULE_COMPLEX_ARGS)
params2.update(params) params2.update(params)

View file

@ -23,6 +23,7 @@ from ansible.runner.return_data import ReturnData
import base64 import base64
import stat import stat
import tempfile import tempfile
import pipes
class ActionModule(object): class ActionModule(object):
@ -119,7 +120,7 @@ class ActionModule(object):
self.runner._low_level_exec_command(conn, "chmod a+r %s" % tmp_src, tmp) self.runner._low_level_exec_command(conn, "chmod a+r %s" % tmp_src, tmp)
# run the copy module # run the copy module
module_args = "%s src=%s" % (module_args, tmp_src) module_args = "%s src=%s" % (module_args, pipes.quote(tmp_src))
return self.runner._execute_module(conn, tmp, 'copy', module_args, inject=inject, complex_args=complex_args) return self.runner._execute_module(conn, tmp, 'copy', module_args, inject=inject, complex_args=complex_args)
else: else:
@ -129,7 +130,7 @@ class ActionModule(object):
if content is not None: if content is not None:
os.remove(tmp_content) os.remove(tmp_content)
tmp_src = tmp + os.path.basename(source) tmp_src = tmp + os.path.basename(source)
module_args = "%s src=%s" % (module_args, tmp_src) module_args = "%s src=%s" % (module_args, pipes.quote(tmp_src))
if self.runner.check: if self.runner.check:
module_args = "%s CHECKMODE=True" % module_args module_args = "%s CHECKMODE=True" % module_args
return self.runner._execute_module(conn, tmp, 'file', module_args, inject=inject, complex_args=complex_args) return self.runner._execute_module(conn, tmp, 'file', module_args, inject=inject, complex_args=complex_args)