mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-21 04:10:23 -07:00
archive - fix removal failures for nested files with tar archives (#2923)
* Initial commit * Adding changelog fragment
This commit is contained in:
parent
00aa1250ee
commit
ffe505a798
3 changed files with 45 additions and 8 deletions
|
@ -399,13 +399,14 @@ class Archive(object):
|
|||
|
||||
def remove_targets(self):
|
||||
for path in self.successes:
|
||||
try:
|
||||
if os.path.isdir(path):
|
||||
shutil.rmtree(path)
|
||||
else:
|
||||
os.remove(path)
|
||||
except OSError:
|
||||
self.errors.append(_to_native(path))
|
||||
if os.path.exists(path):
|
||||
try:
|
||||
if os.path.isdir(path):
|
||||
shutil.rmtree(path)
|
||||
else:
|
||||
os.remove(path)
|
||||
except OSError:
|
||||
self.errors.append(_to_native(path))
|
||||
for path in self.paths:
|
||||
try:
|
||||
if os.path.isdir(path):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue