1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix for recursion traceback in copy with relative paths

This is a further fix for: https://github.com/ansible/ansible/issues/9092

when the relative path contains a subdirectory.  Like:

ansible localhost -m copy -a 'src=/etc/group dest=foo/bar/'
This commit is contained in:
Toshio Kuratomi 2015-02-16 15:34:22 -08:00 committed by Matt Clay
parent cce6cb8d7f
commit 3aba0d5272

View file

@ -181,7 +181,7 @@ def main():
if original_basename and dest.endswith("/"):
dest = os.path.join(dest, original_basename)
dirname = os.path.dirname(dest)
if not os.path.exists(dirname) and '/' in dirname:
if not os.path.exists(dirname) and os.path.isabs(dirname):
(pre_existing_dir, new_directory_list) = split_pre_existing_dir(dirname)
os.makedirs(dirname)
directory_args = module.load_file_common_arguments(module.params)