From 7d2ec56a99dc463cd17aea5ef9bf8df4ffcbd6df Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 14 May 2018 14:52:11 -0700 Subject: [PATCH] Correct bug reporting the diff when state=touch as absent --- lib/ansible/modules/files/file.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/files/file.py b/lib/ansible/modules/files/file.py index ecf6e2a0aa..f59d66c00f 100644 --- a/lib/ansible/modules/files/file.py +++ b/lib/ansible/modules/files/file.py @@ -335,6 +335,7 @@ def execute_touch(path, follow): 'path': path}) elif prev_state == 'link' and follow: + # Update the timestamp of the pointed to file b_link_target = os.readlink(b_path) try: os.utime(b_link_target, None) @@ -348,7 +349,7 @@ def execute_touch(path, follow): ' hardlinks (%s is %s)' % (path, prev_state)}) # Update the attributes on the file - diff = initial_diff(path, 'absent', prev_state) + diff = initial_diff(path, 'touch', prev_state) file_args = module.load_file_common_arguments(module.params) try: module.set_fs_attributes_if_different(file_args, True, diff, expand=False)