From 0d28466b2263a2599b451f7066d1a8c853e6b642 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Sat, 7 Jul 2012 09:29:03 -0400 Subject: [PATCH] When sudo'ing to root, keep the setup file location as /etc/ansible/setup --- lib/ansible/runner/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index 0964cf4c9c..4253398b28 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -263,16 +263,16 @@ class Runner(object): if type(args) == dict: is_dict = True - # TODO: keep this as a dict through the whole path to simplify this code + # TODO: make a _metadata_path function if not is_dict: if args.find("metadata=") == -1: - if self.remote_user == 'root': + if self.remote_user == 'root' or (self.sudo and self.sudo_user == 'root'): args = "%s metadata=/etc/ansible/setup" % args else: args = "%s metadata=%s/setup" % (args, C.DEFAULT_REMOTE_TMP) else: if not 'metadata' in args: - if self.remote_user == 'root': + if self.remote_user == 'root' or (self.sudo and self.sudo_user == 'root'): args['metadata'] = '/etc/ansible/setup' else: args['metadata'] = "%s/setup" % C.DEFAULT_REMOTE_TMP