From 1b1d5d0d3d3f0046da90abe3649ec4ea7b7f5310 Mon Sep 17 00:00:00 2001 From: someda Date: Thu, 24 Jul 2014 14:03:36 +0900 Subject: [PATCH] fix an issue that copying directory will fail when trying to change file attributes and the target file already exists on remote - the issue was introduced by the commit 84759faa0950146a6bae8452580b4a4cede6d871 --- lib/ansible/runner/action_plugins/copy.py | 1 + test/integration/roles/test_copy/tasks/main.yml | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/ansible/runner/action_plugins/copy.py b/lib/ansible/runner/action_plugins/copy.py index 3587ad61ec0..30b3d4ffa8c 100644 --- a/lib/ansible/runner/action_plugins/copy.py +++ b/lib/ansible/runner/action_plugins/copy.py @@ -268,6 +268,7 @@ class ActionModule(object): new_module_args = dict( src=tmp_src, dest=dest, + original_basename=source_rel ) if self.runner.noop_on_check(inject): new_module_args['CHECKMODE'] = True diff --git a/test/integration/roles/test_copy/tasks/main.yml b/test/integration/roles/test_copy/tasks/main.yml index 28c1f973c9a..b1d53a748ae 100644 --- a/test/integration/roles/test_copy/tasks/main.yml +++ b/test/integration/roles/test_copy/tasks/main.yml @@ -151,5 +151,11 @@ # ignore_errors: True # register: failed_copy +- name: copy already copied directory again + copy: src=subdir dest={{output_subdir | expanduser}} owner={{ansible_ssh_user}} + register: copy_result5 - +- name: assert that the directory was not changed + assert: + that: + - "not copy_result5|changed" \ No newline at end of file