From e42848e0fee906967d36e6606153a1cd0f920b2d Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 16 Mar 2015 18:01:59 -0700 Subject: [PATCH] Better comment for why we have get_checksum call itself sometimes --- lib/ansible/runner/action_plugins/template.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/ansible/runner/action_plugins/template.py b/lib/ansible/runner/action_plugins/template.py index a824a6e4b8e..5c9be9e079d 100644 --- a/lib/ansible/runner/action_plugins/template.py +++ b/lib/ansible/runner/action_plugins/template.py @@ -36,7 +36,12 @@ class ActionModule(object): if remote_checksum in ('0', '2', '3', '4'): # Note: 1 means the file is not present which is fine; template # will create it. 3 means directory was specified instead of file + # which requires special handling if try_directory and remote_checksum == '3' and source: + # If the user specified a directory name as their dest then we + # have to check the checksum of dest/basename(src). This is + # the same behaviour as cp foo.txt /var/tmp/ so users expect + # it to work. base = os.path.basename(source) dest = os.path.join(dest, base) remote_checksum = self.get_checksum(conn, tmp, dest, inject, try_directory=False)