diff --git a/CHANGELOG.md b/CHANGELOG.md index 36f587450c7..a34f2d90fc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,17 @@ Ansible Changes By Release ========================== + + +## 2.4.5 "Dancing Days" - TBD + +### Bugfixes + +* Fix win_copy to preserve the global Ansible local tmp path instead of + deleting it when dealing with multiple files + (https://github.com/ansible/ansible/pull/37964) + + ## 2.4.4 "Dancing Days" - 2018-04-04 diff --git a/lib/ansible/plugins/action/win_copy.py b/lib/ansible/plugins/action/win_copy.py index ac0367df24b..d4619adf713 100644 --- a/lib/ansible/plugins/action/win_copy.py +++ b/lib/ansible/plugins/action/win_copy.py @@ -11,6 +11,7 @@ import base64 import json import os import os.path +import shutil import tempfile import traceback import zipfile @@ -320,11 +321,10 @@ class ActionModule(ActionBase): ) ) copy_args.pop('content', None) - os.remove(zip_path) - os.removedirs(os.path.dirname(zip_path)) module_return = self._execute_module(module_args=copy_args, task_vars=task_vars) self._remove_tmp_path(tmp_path) + shutil.rmtree(os.path.dirname(zip_path)) return module_return def run(self, tmp=None, task_vars=None):