Add shell_plugins to abstract shell-specific functions out of runner, add winrm connection plugin, add initial Windows modules.

This commit is contained in:
Chris Church 2014-06-17 15:15:18 -05:00 committed by Matt Martz
parent 627ff30a6f
commit 5dcaa30476
25 changed files with 757 additions and 103 deletions

View file

@ -106,7 +106,8 @@ class ActionModule(object):
# transfer the file to a remote tmp location
source = source.replace('\x00', '') # why does this happen here?
args = args.replace('\x00', '') # why does this happen here?
tmp_src = os.path.join(tmp, os.path.basename(source))
#tmp_src = os.path.join(tmp, os.path.basename(source)) # CCTODO
tmp_src = conn.shell.join_path(tmp, os.path.basename(source))
tmp_src = tmp_src.replace('\x00', '')
conn.put_file(source, tmp_src)
@ -115,14 +116,14 @@ class ActionModule(object):
# set file permissions, more permisive when the copy is done as a different user
if ((self.runner.sudo and self.runner.sudo_user != 'root') or
(self.runner.su and self.runner.su_user != 'root')):
cmd_args_chmod = "chmod a+rx %s" % tmp_src
chmod_mode = 'a+rx'
sudoable = False
else:
cmd_args_chmod = "chmod +rx %s" % tmp_src
self.runner._low_level_exec_command(conn, cmd_args_chmod, tmp, sudoable=sudoable, su=self.runner.su)
chmod_mode = '+rx'
self.runner._remote_chmod(conn, chmod_mode, tmp_src, tmp, sudoable=sudoable, su=self.runner.su)
# 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(conn, inject)
module_args = env_string + tmp_src + ' ' + args
handler = utils.plugins.action_loader.get('raw', self.runner)
@ -130,7 +131,7 @@ class ActionModule(object):
# clean up after
if "tmp" in tmp and not C.DEFAULT_KEEP_REMOTE_FILES:
self.runner._low_level_exec_command(conn, 'rm -rf %s >/dev/null 2>&1' % tmp, tmp)
self.runner._remove_tmp_path(conn, tmp)
result.result['changed'] = True