mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
win_copy: added fix for win_copy deleting local tmp folder (#37964)
This commit is contained in:
parent
68e44e082e
commit
b1ac65d95a
2 changed files with 12 additions and 3 deletions
|
@ -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,12 +321,10 @@ class ActionModule(ActionBase):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
copy_args.pop('content', None)
|
copy_args.pop('content', None)
|
||||||
os.remove(zip_path)
|
|
||||||
|
|
||||||
module_return = self._execute_module(module_name='copy',
|
module_return = self._execute_module(module_name='copy',
|
||||||
module_args=copy_args,
|
module_args=copy_args,
|
||||||
task_vars=task_vars)
|
task_vars=task_vars)
|
||||||
os.removedirs(os.path.dirname(zip_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):
|
||||||
|
|
|
@ -5,6 +5,16 @@
|
||||||
state: directory
|
state: directory
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
|
||||||
|
# removes the cached zip module from the previous task so we can replicate
|
||||||
|
# the below issue where win_copy would delete DEFAULT_LOCAL_TMP if it
|
||||||
|
# had permission to
|
||||||
|
# https://github.com/ansible/ansible/issues/35613
|
||||||
|
- name: clear the local ansiballz cache
|
||||||
|
file:
|
||||||
|
path: "{{lookup('config', 'DEFAULT_LOCAL_TMP')}}/ansiballz_cache"
|
||||||
|
state: absent
|
||||||
|
delegate_to: localhost
|
||||||
|
|
||||||
- name: create test folder
|
- name: create test folder
|
||||||
win_file:
|
win_file:
|
||||||
path: '{{test_win_copy_path}}'
|
path: '{{test_win_copy_path}}'
|
||||||
|
|
Loading…
Reference in a new issue