summaryrefslogtreecommitdiff
path: root/lib/ansible/plugins/action/unarchive.py
diff options
context:
space:
mode:
authorBrian Coca <bcoca@ansible.com>2016-04-20 13:39:12 -0400
committerBrian Coca <bcoca@ansible.com>2016-04-20 13:39:12 -0400
commita5d79a39d51a256937d6e5742befa169629b7caf (patch)
tree00448d97af67d5beb5e6e0365b38e8597ab6bad2 /lib/ansible/plugins/action/unarchive.py
parent67e6bd18e495b32d4748d5eee1c9b8939c1fb715 (diff)
downloadansible-a5d79a39d51a256937d6e5742befa169629b7caf.tar.gz
Ensure action plugins remove tmp dirs created (#15501)
fixes #14917
Diffstat (limited to 'lib/ansible/plugins/action/unarchive.py')
-rw-r--r--lib/ansible/plugins/action/unarchive.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/ansible/plugins/action/unarchive.py b/lib/ansible/plugins/action/unarchive.py
index 6ace6f9975..590881165e 100644
--- a/lib/ansible/plugins/action/unarchive.py
+++ b/lib/ansible/plugins/action/unarchive.py
@@ -48,6 +48,7 @@ class ActionModule(ActionBase):
remote_user = task_vars.get('ansible_ssh_user') or self._play_context.remote_user
if not tmp:
tmp = self._make_tmp_path(remote_user)
+ self._cleanup_remote_tmp = True
if creates:
# do not run the command if the line contains creates=filename
@@ -58,6 +59,7 @@ class ActionModule(ActionBase):
if stat and stat.get('exists', False):
result['skipped'] = True
result['msg'] = "skipped, since %s exists" % creates
+ self._remove_tmp_path(tmp)
return result
dest = self._remote_expand_user(dest) # CCTODO: Fix path for Windows hosts.
@@ -73,10 +75,12 @@ class ActionModule(ActionBase):
if remote_checksum == '4':
result['failed'] = True
result['msg'] = "python isn't present on the system. Unable to compute checksum"
+ self._remove_tmp_path(tmp)
return result
elif remote_checksum != '3':
result['failed'] = True
result['msg'] = "dest '%s' must be an existing dir" % dest
+ self._remove_tmp_path(tmp)
return result
if copy:
@@ -109,4 +113,5 @@ class ActionModule(ActionBase):
# execute the unarchive module now, with the updated args
result.update(self._execute_module(module_args=new_module_args, task_vars=task_vars))
+ self._remove_tmp_path(tmp)
return result