Ensure action plugins remove tmp dirs created (#15501)

fixes #14917
This commit is contained in:
Brian Coca 2016-04-20 13:39:12 -04:00
parent 67e6bd18e4
commit a5d79a39d5
8 changed files with 29 additions and 18 deletions

View file

@ -41,6 +41,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
module_name = self._task.action
async_module_path = self._connection._shell.join_path(tmp, 'async_wrapper')
@ -91,8 +92,7 @@ class ActionModule(ActionBase):
result.update(self._low_level_execute_command(cmd=async_cmd))
# clean up after
if tmp and "tmp" in tmp and not C.DEFAULT_KEEP_REMOTE_FILES:
self._remove_tmp_path(tmp)
self._remove_tmp_path(tmp)
result['changed'] = True