issue #558, #582: preserve remote tmpdir if caller did not supply one

The undocumented 'tmp' parameter controls whether _execute_module()
would delete anything on 2.3, so mimic that. This means
_execute_remove_stat() calls will not blow away the temp directory,
which broke the unarchive plugin.
new-serialization
David Wilson 5 years ago
parent 0c1d882547
commit 8dfb3966df

@ -360,11 +360,10 @@ 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:
if tmp and ansible.__version__ < '2.5' and delete_remote_tmp:
# Built-in actions expected tmpdir to be cleaned up automatically
# on _execute_module().
self._remove_tmp_path(self._connection._shell.tmpdir)
self._remove_tmp_path(tmp)
return result

@ -93,6 +93,11 @@ Mitogen for Ansible
default soft limit, allowing *"too many open files"* errors to be avoided
more often in large runs without user configuration.
* `#558 <https://github.com/dw/mitogen/issues/558>`_,
`#582 <https://github.com/dw/mitogen/issues/582>`_: on Ansible 2.3 a remote
directory was unconditionally deleted after the first module belonging to an
action plug-in had executed, causing the ``unarchive`` module to fail.
* `#578 <https://github.com/dw/mitogen/issues/578>`_: the extension could crash
while rendering an error message, due to an incorrect format string.
@ -223,6 +228,7 @@ bug reports, testing, features and fixes in this release contributed by
`Dave Cottlehuber <https://github.com/dch>`_,
`Denis Krienbühl <https://github.com/href>`_,
`El Mehdi CHAOUKI <https://github.com/elmchaouki>`_,
`Florent Dutheil <https://github.com/fdutheil>`_,
`James Hogarth <https://github.com/hogarthj>`_,
`Marc Hartmayer <https://github.com/marc1006>`_,
`Nigel Metheringham <https://github.com/nigelm>`_,
@ -235,8 +241,10 @@ bug reports, testing, features and fixes in this release contributed by
`Yuki Nishida <https://github.com/yuki-nishida-exa>`_,
`@alexhexabeam <https://github.com/alexhexabeam>`_,
`@DavidVentura <https://github.com/DavidVentura>`_,
`@dbiegunski <https://github.com/dbiegunski>`_,
`@ghp-rr <https://github.com/ghp-rr>`_,
`@rizzly <https://github.com/rizzly>`_, and
`@rizzly <https://github.com/rizzly>`_,
`@SQGE <https://github.com/SQGE>`_, and
`@tho86 <https://github.com/tho86>`_.

@ -8,5 +8,6 @@
- include: issue_154__module_state_leaks.yml
- include: issue_177__copy_module_failing.yml
- include: issue_332_ansiblemoduleerror_first_occurrence.yml
- include: issue_558_unarchive_failed.yml
- include: issue_590__sys_modules_crap.yml
- include: issue_591__setuptools_cwd_crash.yml

@ -0,0 +1,11 @@
# _execute_module() would unconditionally delete shell.tmpdir without
# respecting the passed in 'tmp' parameter on Ansible 2.3.
- name: regression/issue_558_unarchive_failed.yml
hosts: test-targets
tasks:
- file: state=absent path=/tmp/foo
- file: state=directory path=/tmp/foo
- unarchive:
src: "{{git_basedir}}/tests/data/unarchive_test.tar"
dest: /tmp/foo

Binary file not shown.
Loading…
Cancel
Save