From 5f6121856fe7c4e5194b46fad26d1bbb11d88ab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gross?= Date: Fri, 20 Mar 2015 17:19:15 +0100 Subject: [PATCH] Make sure the absolute patch file is passed to the patch command. According the patch(1) manpage: The --directory option change to the directory dir immediately, before doing anything else. Thus if file is not relative to dir and making file absolute ensure that patch will find it. --- lib/ansible/modules/extras/files/patch.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ansible/modules/extras/files/patch.py b/lib/ansible/modules/extras/files/patch.py index 314a1bc37d..78bcefe6d3 100755 --- a/lib/ansible/modules/extras/files/patch.py +++ b/lib/ansible/modules/extras/files/patch.py @@ -145,6 +145,9 @@ def main(): module.fail_json(msg="patch command not found") patch_func = lambda opts: module.run_command("%s %s" % (patch_bin, ' '.join(opts))) + # patch need an absolute file name + p.src = os.path.abspath(p.src) + changed = False if not is_already_applied(patch_func, p.src, p.basedir, dest_file=p.dest, strip=p.strip): try: