mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix old ticket #9092 where a playbook can enter in recursion
This can be tested with this command : ansible -c local -m copy -a 'src=/etc/group dest=foo/' all This is a corner case of the algorithm used to find how we should copy recursively a folder, and this commit detect it and avoid it. Check https://github.com/ansible/ansible/issues/9092 for the story
This commit is contained in:
parent
3f4d412bff
commit
4e4e0cca17
1 changed files with 1 additions and 1 deletions
|
@ -181,7 +181,7 @@ def main():
|
||||||
if original_basename and dest.endswith("/"):
|
if original_basename and dest.endswith("/"):
|
||||||
dest = os.path.join(dest, original_basename)
|
dest = os.path.join(dest, original_basename)
|
||||||
dirname = os.path.dirname(dest)
|
dirname = os.path.dirname(dest)
|
||||||
if not os.path.exists(dirname):
|
if not os.path.exists(dirname) and '/' in dirname:
|
||||||
(pre_existing_dir, new_directory_list) = split_pre_existing_dir(dirname)
|
(pre_existing_dir, new_directory_list) = split_pre_existing_dir(dirname)
|
||||||
os.makedirs(dirname)
|
os.makedirs(dirname)
|
||||||
directory_args = module.load_file_common_arguments(module.params)
|
directory_args = module.load_file_common_arguments(module.params)
|
||||||
|
|
Loading…
Reference in a new issue