From 59d655c54314cd3e84d1381359c84d59f76d62a4 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Thu, 8 Oct 2015 16:21:52 -0400 Subject: [PATCH] Double echo temp directory name to handle spaces and ~ expansion both Fixes #12667 --- lib/ansible/plugins/shell/sh.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/plugins/shell/sh.py b/lib/ansible/plugins/shell/sh.py index 835a27cae65..b080d36fca1 100644 --- a/lib/ansible/plugins/shell/sh.py +++ b/lib/ansible/plugins/shell/sh.py @@ -67,8 +67,8 @@ class ShellModule(object): basetmp = self.join_path(C.DEFAULT_REMOTE_TMP, basefile) if system and (basetmp.startswith('$HOME') or basetmp.startswith('~/')): basetmp = self.join_path('/tmp', basefile) - cmd = 'mkdir -p "%s"' % basetmp - cmd += ' && echo "%s"' % basetmp + cmd = 'mkdir -p "$(echo %s)"' % basetmp + cmd += ' && echo "$(echo %s)"' % basetmp # change the umask in a subshell to achieve the desired mode # also for directories created with `mkdir -p`