archive: remove path folder itself when remove paramater is true (#1083)

* Remove paths folders themselves

* Add changelog

* Add remove integration test

* Check excluded file
This commit is contained in:
Amin Vakil 2020-11-19 23:21:16 +03:30 committed by GitHub
commit 9ccc0464ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 136 additions and 0 deletions

View file

@ -453,6 +453,13 @@ def main():
except OSError as e:
errors.append(to_native(b_path))
for b_path in b_expanded_paths:
try:
if os.path.isdir(b_path):
shutil.rmtree(b_path)
except OSError as e:
errors.append(to_native(b_path))
if errors:
module.fail_json(dest=dest, msg='Error deleting some source files: ', files=errors)