Commit 0d28466b by Michael DeHaan

When sudo'ing to root, keep the setup file location as /etc/ansible/setup

parent c592fdf8
...@@ -263,16 +263,16 @@ class Runner(object): ...@@ -263,16 +263,16 @@ class Runner(object):
if type(args) == dict: if type(args) == dict:
is_dict = True 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 not is_dict:
if args.find("metadata=") == -1: 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 args = "%s metadata=/etc/ansible/setup" % args
else: else:
args = "%s metadata=%s/setup" % (args, C.DEFAULT_REMOTE_TMP) args = "%s metadata=%s/setup" % (args, C.DEFAULT_REMOTE_TMP)
else: else:
if not 'metadata' in args: 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' args['metadata'] = '/etc/ansible/setup'
else: else:
args['metadata'] = "%s/setup" % C.DEFAULT_REMOTE_TMP args['metadata'] = "%s/setup" % C.DEFAULT_REMOTE_TMP
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment