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:
try:
(k, v) = x.split("=",1)
except:
self.fail_json(msg="this module requires key=value arguments")
except Exception, e:
self.fail_json(msg="this module requires key=value arguments (%s)" % items)
params[k] = v
params2 = json.loads(MODULE_COMPLEX_ARGS)
params2.update(params)

View file

@ -23,6 +23,7 @@ from ansible.runner.return_data import ReturnData
import base64
import stat
import tempfile
import pipes
class ActionModule(object):
@ -119,7 +120,7 @@ class ActionModule(object):
self.runner._low_level_exec_command(conn, "chmod a+r %s" % tmp_src, tmp)
# 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)
else:
@ -129,7 +130,7 @@ class ActionModule(object):
if content is not None:
os.remove(tmp_content)
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:
module_args = "%s CHECKMODE=True" % module_args
return self.runner._execute_module(conn, tmp, 'file', module_args, inject=inject, complex_args=complex_args)