From 9e0959d600e5414b53eeb32ee1eba1a46d43daf6 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 16 Feb 2015 15:34:22 -0800 Subject: [PATCH] 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/' --- files/copy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/copy.py b/files/copy.py index c5aaa01b5b3..364996f5293 100644 --- a/files/copy.py +++ b/files/copy.py @@ -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)