From cfe9f1c32f4f76eee5f385508b40ad4608916ba0 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 10 Nov 2014 10:39:34 -0800 Subject: [PATCH] Expand tilde in path names --- lib/ansible/runner/shell_plugins/sh.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ansible/runner/shell_plugins/sh.py b/lib/ansible/runner/shell_plugins/sh.py index 134c857f171..52e3f68f336 100644 --- a/lib/ansible/runner/shell_plugins/sh.py +++ b/lib/ansible/runner/shell_plugins/sh.py @@ -37,10 +37,12 @@ class ShellModule(object): return path.endswith('/') def chmod(self, mode, path): + path = os.path.expanduser(path) path = pipes.quote(path) return 'chmod %s %s' % (mode, path) def remove(self, path, recurse=False): + path = os.path.expanduser(path) path = pipes.quote(path) if recurse: return "rm -rf %s >/dev/null 2>&1" % path @@ -60,6 +62,7 @@ class ShellModule(object): return cmd def checksum(self, path, python_interp): + path = os.path.expanduser(path) path = pipes.quote(path) # The following test needs to be SH-compliant. BASH-isms will # not work if /bin/sh points to a non-BASH shell.