From cccfebec74cb58289a29be66d68d531b8292d0aa Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sun, 18 Feb 2018 13:53:00 +0545 Subject: [PATCH] ansible: correct temp file cleanup for template action. --- ansible_mitogen/mixins.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ansible_mitogen/mixins.py b/ansible_mitogen/mixins.py index 038a0fd1..11335710 100644 --- a/ansible_mitogen/mixins.py +++ b/ansible_mitogen/mixins.py @@ -26,8 +26,9 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from __future__ import absolute_import -import pwd import os +import pwd +import shutil import tempfile import ansible @@ -100,7 +101,9 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase): def _make_tmp_path(self, remote_user=None): # replaces 58 lines - return self.call(tempfile.mkdtemp, prefix='ansible_mitogen') + path = self.call(tempfile.mkdtemp, prefix='ansible-mitogen-tmp-') + self._cleanup_remote_tmp = True + return path def _remove_tmp_path(self, tmp_path): # replaces 10 lines