* archive: Fix check if archive is created in path to be removed (#29420)
(cherry picked from commit 3a45de4209
)
* add changelog
This commit is contained in:
parent
80b5b33e2b
commit
f2d4187761
2 changed files with 9 additions and 2 deletions
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- archive - Fix check if archive is created in path to be removed
|
|
@ -261,8 +261,13 @@ def main():
|
|||
arcroot += os.sep
|
||||
|
||||
# Don't allow archives to be created anywhere within paths to be removed
|
||||
if remove and os.path.isdir(path) and dest.startswith(path):
|
||||
module.fail_json(path=', '.join(paths), msg='Error, created archive can not be contained in source paths when remove=True')
|
||||
if remove and os.path.isdir(path):
|
||||
path_dir = path
|
||||
if path[-1] != '/':
|
||||
path_dir += '/'
|
||||
|
||||
if dest.startswith(path_dir):
|
||||
module.fail_json(path=', '.join(paths), msg='Error, created archive can not be contained in source paths when remove=True')
|
||||
|
||||
if os.path.lexists(path) and path not in expanded_exclude_paths:
|
||||
archive_paths.append(path)
|
||||
|
|
Loading…
Reference in a new issue