ansible: implement _transfer_data for <2.4 template action
This commit is contained in:
parent
7aca02c2c7
commit
b63af1de85
|
@ -262,6 +262,19 @@ class Connection(ansible.plugins.connection.ConnectionBase):
|
|||
cast(in_path))
|
||||
ansible_mitogen.helpers.write_path(out_path, output)
|
||||
|
||||
def put_data(self, out_path, data):
|
||||
"""
|
||||
Implement put_file() by caling the corresponding
|
||||
ansible_mitogen.helpers function in the target.
|
||||
|
||||
:param str in_path:
|
||||
Local filesystem path to read.
|
||||
:param str out_path:
|
||||
Remote filesystem path to write.
|
||||
"""
|
||||
self.call(ansible_mitogen.helpers.write_path,
|
||||
cast(out_path), cast(data))
|
||||
|
||||
def put_file(self, in_path, out_path):
|
||||
"""
|
||||
Implement put_file() by caling the corresponding
|
||||
|
@ -272,5 +285,4 @@ class Connection(ansible.plugins.connection.ConnectionBase):
|
|||
:param str out_path:
|
||||
Remote filesystem path to write.
|
||||
"""
|
||||
self.call(ansible_mitogen.helpers.write_path, cast(out_path),
|
||||
ansible_mitogen.helpers.read_path(in_path))
|
||||
self.put_data(out_path, ansible_mitogen.helpers.read_path(in_path))
|
||||
|
|
|
@ -202,10 +202,10 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase):
|
|||
|
||||
def _transfer_data(self, remote_path, data):
|
||||
"""
|
||||
This is used by the base implementation of _execute_module(), it should
|
||||
never be called.
|
||||
Used by the base _execute_module(), and in <2.4 also by the template
|
||||
action module, and probably others.
|
||||
"""
|
||||
assert False, "_transfer_data() should never be called."
|
||||
self._connection.put_data(remote_path, data)
|
||||
|
||||
def _fixup_perms2(self, remote_paths, remote_user=None, execute=True):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue