From 66ba31aeb065c36280fbbd63184b4c88983c23fb Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Tue, 24 Apr 2012 08:06:32 -0400 Subject: [PATCH 1/2] Fix bug in library/file --- library/file | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/file b/library/file index e0ebbecb17..402b79ba46 100755 --- a/library/file +++ b/library/file @@ -318,8 +318,9 @@ elif state == 'link': if os.path.isabs(src): abs_src = src else: - abs_src = os.path.join(os.path.dirname(dest)) - if not os.path.exists(abssrc): + # FIXME: this does not seem correct? -- MPD + abs_src = os.path.dirname(dest) + if not os.path.exists(abs_src): fail_json(dest=dest, src=src, msg='src file does not exist') if prev_state == 'absent': From dbb4afff50cc65092f2488af09d878be4d772229 Mon Sep 17 00:00:00 2001 From: Chris Read Date: Tue, 24 Apr 2012 21:45:54 +0100 Subject: [PATCH 2/2] Use the /Users/cread env var instead of hard coding /home/ --- lib/ansible/runner.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/ansible/runner.py b/lib/ansible/runner.py index fcb26cc4ca..0bbb94ae2d 100644 --- a/lib/ansible/runner.py +++ b/lib/ansible/runner.py @@ -253,13 +253,13 @@ class Runner(object): if self.remote_user == 'root': args = "%s metadata=/etc/ansible/setup" % args else: - args = "%s metadata=/home/%s/.ansible/setup" % (args, self.remote_user) + args = "%s metadata=$HOME/.ansible/setup" % args else: if not 'metadata' in args: if self.remote_user == 'root': args['metadata'] = '/etc/ansible/setup' else: - args['metadata'] = "/home/%s/.ansible/setup" % (self.remote_user) + args['metadata'] = "$HOME/.ansible/setup" return args # ***************************************************** @@ -617,10 +617,14 @@ class Runner(object): def _get_tmp_path(self, conn): ''' 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" if self.remote_user != 'root': - basetmp = "/home/%s/.ansible/tmp" % self.remote_user - cmd = "mktemp -d %s/ansible.XXXXXX" % basetmp + basetmp = "$HOME/.ansible/tmp" + cmd = "mktemp -d %s/ansible.XXXXXX" % basetmp if self.remote_user != 'root': cmd = "mkdir -p %s && %s" % (basetmp, cmd)