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 #1878 from leucos/patch-1

Fix sudo user env
This commit is contained in:
Michael DeHaan 2013-01-18 15:08:39 -08:00
commit 224b503b78

View file

@ -544,6 +544,6 @@ def make_sudo_cmd(sudo_user, executable, cmd):
# the -p option.
randbits = ''.join(chr(random.randint(ord('a'), ord('z'))) for x in xrange(32))
prompt = '[sudo via ansible, key=%s] password: ' % randbits
sudocmd = 'sudo -k && sudo -S -p "%s" -u %s %s -c %s' % (
sudocmd = 'sudo -k && sudo -S -p "%s" -i -u %s %s -c %s' % (
prompt, sudo_user, executable or '$SHELL', pipes.quote(cmd))
return ('/bin/sh -c ' + pipes.quote(sudocmd), prompt)