From c8ac02d6f23a786dd1ea5404c29ae213905febbc Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 14 May 2018 10:12:40 -0700 Subject: [PATCH] Emit a warning when src is used with a state where it should be ignored --- lib/ansible/plugins/action/copy.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ansible/plugins/action/copy.py b/lib/ansible/plugins/action/copy.py index ef53b2cadda..f81a4620fd9 100644 --- a/lib/ansible/plugins/action/copy.py +++ b/lib/ansible/plugins/action/copy.py @@ -337,13 +337,17 @@ class ActionModule(ActionBase): new_module_args = _create_remote_file_args(self._task.args) new_module_args.update( dict( - src=source_rel, dest=dest, original_basename=source_rel, recurse=False, state='file', ) ) + # src is sent to the file module in _original_basename, not in src + try: + del new_module_args['src'] + except KeyError: + pass if lmode: new_module_args['mode'] = lmode