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

pull/2362/merge
Michael DeHaan 12 years ago
parent 4eaca08664
commit 6e2ea327d1

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

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

Loading…
Cancel
Save