win_copy: added fix for win_copy deleting local tmp folder (#37978)

This commit is contained in:
Jordan Borean 2018-04-06 07:18:53 +10:00 committed by GitHub
parent 971697052b
commit 37901bba41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View file

@ -1,6 +1,17 @@
Ansible Changes By Release Ansible Changes By Release
========================== ==========================
<a id="2.4.5"></a>
## 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)
<a id="2.4.4"></a> <a id="2.4.4"></a>
## 2.4.4 "Dancing Days" - 2018-04-04 ## 2.4.4 "Dancing Days" - 2018-04-04

View file

@ -11,6 +11,7 @@ import base64
import json import json
import os import os
import os.path import os.path
import shutil
import tempfile import tempfile
import traceback import traceback
import zipfile import zipfile
@ -320,11 +321,10 @@ class ActionModule(ActionBase):
) )
) )
copy_args.pop('content', None) 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) module_return = self._execute_module(module_args=copy_args, task_vars=task_vars)
self._remove_tmp_path(tmp_path) self._remove_tmp_path(tmp_path)
shutil.rmtree(os.path.dirname(zip_path))
return module_return return module_return
def run(self, tmp=None, task_vars=None): def run(self, tmp=None, task_vars=None):