issue #554: fix Ansible 2.4 compatibility
This commit is contained in:
parent
f36b4b47bf
commit
6309774be2
|
@ -354,7 +354,7 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase):
|
|||
self._temp_file_gibberish(module_args, wrap_async)
|
||||
|
||||
self._connection._connect()
|
||||
return ansible_mitogen.planner.invoke(
|
||||
result = ansible_mitogen.planner.invoke(
|
||||
ansible_mitogen.planner.Invocation(
|
||||
action=self,
|
||||
connection=self._connection,
|
||||
|
@ -368,6 +368,14 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase):
|
|||
)
|
||||
)
|
||||
|
||||
if ansible.__version__ < '2.5' and delete_remote_tmp and \
|
||||
getattr(self._connection._shell, 'tmpdir', None) is not None:
|
||||
# Built-in actions expected tmpdir to be cleaned up automatically
|
||||
# on _execute_module().
|
||||
self._remove_tmp_path(self._connection._shell.tmpdir)
|
||||
|
||||
return result
|
||||
|
||||
def _postprocess_response(self, result):
|
||||
"""
|
||||
Apply fixups mimicking ActionBase._execute_module(); this is copied
|
||||
|
|
|
@ -260,14 +260,6 @@ def prune_tree(path):
|
|||
LOG.error('prune_tree(%r): %s', path, e)
|
||||
|
||||
|
||||
def _on_broker_shutdown():
|
||||
"""
|
||||
Respond to broker shutdown (graceful termination by parent, or loss of
|
||||
connection to parent) by deleting our sole temporary directory.
|
||||
"""
|
||||
prune_tree(temp_dir)
|
||||
|
||||
|
||||
def is_good_temp_dir(path):
|
||||
"""
|
||||
Return :data:`True` if `path` can be used as a temporary directory, logging
|
||||
|
|
|
@ -6,9 +6,6 @@
|
|||
hosts: test-targets
|
||||
any_errors_fatal: true
|
||||
tasks:
|
||||
- meta: end_play
|
||||
when: not is_mitogen
|
||||
|
||||
#
|
||||
# Use the copy module to cause a temporary directory to be created, and
|
||||
# return a result with a 'src' attribute pointing into that directory.
|
||||
|
|
Loading…
Reference in New Issue