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

This commit is contained in:
Michael DeHaan 2012-07-07 09:29:03 -04:00
parent b8d9419d38
commit 79e47f53dd

View file

@ -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