Commit e6d898cd by Michael DeHaan

Merge pull request #734 from willthames/local_sudo

Use sudo_user as an argument in the sudo command
parents a8d13fe4 7e279f97
...@@ -42,7 +42,7 @@ class LocalConnection(object): ...@@ -42,7 +42,7 @@ class LocalConnection(object):
# to do so. The primary usage of the local connection is for crontab and kickstart usage however # to do so. The primary usage of the local connection is for crontab and kickstart usage however
# so this doesn't seem to be a huge priority # so this doesn't seem to be a huge priority
raise errors.AnsibleError("sudo with password is presently only supported on the paramiko (SSH) connection type") raise errors.AnsibleError("sudo with password is presently only supported on the paramiko (SSH) connection type")
cmd = "sudo -s %s" % cmd cmd = "sudo -u {0} -s {1}".format(sudo_user, cmd)
p = subprocess.Popen(cmd, shell=True, stdin=None, p = subprocess.Popen(cmd, shell=True, stdin=None,
stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout=subprocess.PIPE, stderr=subprocess.PIPE)
......
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