From 0faecdf7d1e8b2af1e69a7a67fffa3731ef130e3 Mon Sep 17 00:00:00 2001 From: James Tanner Date: Mon, 28 Oct 2013 22:50:55 -0400 Subject: [PATCH] Fixes #4653 Set dest on results for copy module even if using file module --- lib/ansible/runner/action_plugins/copy.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/ansible/runner/action_plugins/copy.py b/lib/ansible/runner/action_plugins/copy.py index a3f0379220..9d3973a831 100644 --- a/lib/ansible/runner/action_plugins/copy.py +++ b/lib/ansible/runner/action_plugins/copy.py @@ -174,7 +174,9 @@ class ActionModule(object): module_args = "%s src=%s" % (module_args, pipes.quote(tmp_src)) if self.runner.noop_on_check(inject): module_args = "%s CHECKMODE=True" % module_args - return self.runner._execute_module(conn, tmp, 'file', module_args, inject=inject, complex_args=complex_args) + results = self.runner._execute_module(conn, tmp, 'file', module_args, inject=inject, complex_args=complex_args) + results = self._result_key_merge(options, results) + return results def _get_diff_data(self, conn, tmp, inject, destination, source): peek_result = self.runner._execute_module(conn, tmp, 'file', "path=%s diff_peek=1" % destination, inject=inject, persist_files=True) @@ -213,3 +215,10 @@ class ActionModule(object): diff['after'] = src.read() return diff + + def _result_key_merge(self, options, results): + # add keys to file module results to mimic copy + if 'path' in results.result and 'dest' not in results.result: + results.result['dest'] = results.result['path'] + del results.result['path'] + return results