now correctly changes script permission in all cases

Signed-off-by: Brian Coca <briancoca+ansible@gmail.com>
pull/4591/head
Brian Coca 11 years ago
parent 1d090b5b25
commit c476ed93ca

@ -58,15 +58,18 @@ class ActionModule(object):
conn.put_file(source, tmp_src) conn.put_file(source, tmp_src)
# fix file permissions when the copy is done as a different user sudoable=True
# set file permissions, more permisive when the copy is done as a different user
if self.runner.sudo and self.runner.sudo_user != 'root': if self.runner.sudo and self.runner.sudo_user != 'root':
prepcmd = 'chmod a+rx %s' % tmp_src cmd_args_chmod = "chmod a+rx %s" % tmp_src
sudoable=False
else: else:
prepcmd = 'chmod +x %s' % tmp_src cmd_args_chmod = "chmod +rx %s" % tmp_src
self.runner._low_level_exec_command(conn, cmd_args_chmod, tmp, sudoable=sudoable)
# add preparation steps to one ssh roundtrip executing the script # add preparation steps to one ssh roundtrip executing the script
env_string = self.runner._compute_environment_string(inject) env_string = self.runner._compute_environment_string(inject)
module_args = prepcmd + '; ' + env_string + tmp_src + ' ' + args module_args = env_string + tmp_src + ' ' + args
handler = utils.plugins.action_loader.get('raw', self.runner) handler = utils.plugins.action_loader.get('raw', self.runner)
result = handler.run(conn, tmp, 'raw', module_args, inject) result = handler.run(conn, tmp, 'raw', module_args, inject)

Loading…
Cancel
Save