1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #226 from cread/make-osx-tests-pass

Use the $HOME env var instead of hard coding /home/<username>
This commit is contained in:
Michael DeHaan 2012-04-24 15:22:43 -07:00
commit 87b1cf45a4

View file

@ -253,13 +253,13 @@ class Runner(object):
if self.remote_user == 'root': if self.remote_user == 'root':
args = "%s metadata=/etc/ansible/setup" % args args = "%s metadata=/etc/ansible/setup" % args
else: else:
args = "%s metadata=/home/%s/.ansible/setup" % (args, self.remote_user) args = "%s metadata=$HOME/.ansible/setup" % args
else: else:
if not 'metadata' in args: if not 'metadata' in args:
if self.remote_user == 'root': if self.remote_user == 'root':
args['metadata'] = '/etc/ansible/setup' args['metadata'] = '/etc/ansible/setup'
else: else:
args['metadata'] = "/home/%s/.ansible/setup" % (self.remote_user) args['metadata'] = "$HOME/.ansible/setup"
return args return args
# ***************************************************** # *****************************************************
@ -620,10 +620,14 @@ class Runner(object):
def _get_tmp_path(self, conn): def _get_tmp_path(self, conn):
''' gets a temporary path on a remote box ''' ''' gets a temporary path on a remote box '''
# The problem with this is that it's executed on the
# overlord, not on the target so we can't use tempdir and os.path
# Only support the *nix world for now by using the $HOME env var
basetmp = "/var/tmp" basetmp = "/var/tmp"
if self.remote_user != 'root': if self.remote_user != 'root':
basetmp = "/home/%s/.ansible/tmp" % self.remote_user basetmp = "$HOME/.ansible/tmp"
cmd = "mktemp -d %s/ansible.XXXXXX" % basetmp cmd = "mktemp -d %s/ansible.XXXXXX" % basetmp
if self.remote_user != 'root': if self.remote_user != 'root':
cmd = "mkdir -p %s && %s" % (basetmp, cmd) cmd = "mkdir -p %s && %s" % (basetmp, cmd)