|
|
|
|
@ -46,6 +46,7 @@ from ansible.plugins.connections import ConnectionBase
|
|
|
|
|
from ansible.plugins import shell_loader
|
|
|
|
|
from ansible.utils.path import makedirs_safe
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Connection(ConnectionBase):
|
|
|
|
|
'''WinRM connections over HTTP/HTTPS.'''
|
|
|
|
|
|
|
|
|
|
@ -152,6 +153,7 @@ class Connection(ConnectionBase):
|
|
|
|
|
return self
|
|
|
|
|
|
|
|
|
|
def exec_command(self, cmd, tmp_path, executable='/bin/sh', in_data=None):
|
|
|
|
|
super(Connection, self).exec_command(cmd, tmp_path, executable=executable, in_data,in_data)
|
|
|
|
|
|
|
|
|
|
cmd = cmd.encode('utf-8')
|
|
|
|
|
cmd_parts = shlex.split(cmd, posix=False)
|
|
|
|
|
@ -173,6 +175,8 @@ class Connection(ConnectionBase):
|
|
|
|
|
return (result.status_code, '', result.std_out.encode('utf-8'), result.std_err.encode('utf-8'))
|
|
|
|
|
|
|
|
|
|
def put_file(self, in_path, out_path):
|
|
|
|
|
super(Connection, self).put_file(in_path, out_path)
|
|
|
|
|
|
|
|
|
|
self._display.vvv("PUT %s TO %s" % (in_path, out_path), host=self._connection_info.remote_addr)
|
|
|
|
|
if not os.path.exists(in_path):
|
|
|
|
|
raise AnsibleFileNotFound("file or module does not exist: %s" % in_path)
|
|
|
|
|
@ -211,6 +215,8 @@ class Connection(ConnectionBase):
|
|
|
|
|
raise AnsibleError("failed to transfer file to %s" % out_path)
|
|
|
|
|
|
|
|
|
|
def fetch_file(self, in_path, out_path):
|
|
|
|
|
super(Connection, self).fetch_file(in_path, out_path)
|
|
|
|
|
|
|
|
|
|
out_path = out_path.replace('\\', '/')
|
|
|
|
|
self._display.vvv("FETCH %s TO %s" % (in_path, out_path), host=self._connection_info.remote_addr)
|
|
|
|
|
buffer_size = 2**19 # 0.5MB chunks
|
|
|
|
|
|