From 6a97d6386fe5735eb271f165e6c983883bf90946 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 11 Apr 2016 20:00:10 -0700 Subject: [PATCH] Always use system /tmp if system=True. Otherwise unexpected errors can happen when the user sets remote_tmp. Fixes #15372 --- lib/ansible/plugins/shell/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/plugins/shell/__init__.py b/lib/ansible/plugins/shell/__init__.py index c8224eaf7a..9285ded4d3 100644 --- a/lib/ansible/plugins/shell/__init__.py +++ b/lib/ansible/plugins/shell/__init__.py @@ -112,7 +112,7 @@ class ShellBase(object): if not basefile: basefile = 'ansible-tmp-%s-%s' % (time.time(), random.randint(0, 2**48)) basetmp = self.join_path(C.DEFAULT_REMOTE_TMP, basefile) - if system and (basetmp.startswith('$HOME') or basetmp.startswith('~/')): + if system: basetmp = self.join_path('/tmp', basefile) cmd = 'mkdir -p %s echo %s %s' % (self._SHELL_SUB_LEFT, basetmp, self._SHELL_SUB_RIGHT) cmd += ' %s echo %s echo %s %s' % (self._SHELL_AND, self._SHELL_SUB_LEFT, basetmp, self._SHELL_SUB_RIGHT)