From 8a5f162e29f45ce427606706f7e3908ec4ca2bda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gross?= Date: Fri, 20 Mar 2015 16:45:54 +0100 Subject: [PATCH 1/2] [patch] fix "remote_src" behavior according patch module documentation. Patch documentation says "remote_src" us False by default. That was not the case in the action plugin. --- lib/ansible/runner/action_plugins/patch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/runner/action_plugins/patch.py b/lib/ansible/runner/action_plugins/patch.py index dbba4c53dd7..ebd0c6cf594 100644 --- a/lib/ansible/runner/action_plugins/patch.py +++ b/lib/ansible/runner/action_plugins/patch.py @@ -32,7 +32,7 @@ class ActionModule(object): src = options.get('src', None) dest = options.get('dest', None) - remote_src = utils.boolean(options.get('remote_src', 'yes')) + remote_src = utils.boolean(options.get('remote_src', 'no')) if src is None: result = dict(failed=True, msg="src is required") From 6888f1ccd9a60d656b868317c9fa46e9524bd3f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gross?= Date: Fri, 20 Mar 2015 17:13:50 +0100 Subject: [PATCH 2/2] [patch] Use _make_tmp_path to prevent from copying full patch file path. --- lib/ansible/runner/action_plugins/patch.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/runner/action_plugins/patch.py b/lib/ansible/runner/action_plugins/patch.py index ebd0c6cf594..29d4f7eca5a 100644 --- a/lib/ansible/runner/action_plugins/patch.py +++ b/lib/ansible/runner/action_plugins/patch.py @@ -47,7 +47,10 @@ class ActionModule(object): else: src = utils.path_dwim(self.runner.basedir, src) - tmp_src = tmp + src + if tmp is None or "-tmp-" not in tmp: + tmp = self.runner._make_tmp_path(conn) + + tmp_src = conn.shell.join_path(tmp, os.path.basename(src)) conn.put_file(src, tmp_src) if self.runner.become and self.runner.become_user != 'root':