mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-29 11:40:22 -07:00
sudo -u works now. Needs testing and maybe a bit of cleanup
This commit is contained in:
parent
93a20a33e9
commit
8d39ae709c
2 changed files with 10 additions and 8 deletions
|
@ -116,8 +116,9 @@ class Runner(object):
|
|||
|
||||
self.generated_jid = str(random.randint(0, 999999999999))
|
||||
|
||||
self.sudo_user = sudo_user
|
||||
self.transport = transport
|
||||
self.connector = ansible.connection.Connection(self, self.transport)
|
||||
self.connector = ansible.connection.Connection(self, self.transport, self.sudo_user)
|
||||
|
||||
if inventory is None:
|
||||
self.inventory = ansible.inventory.Inventory(host_list)
|
||||
|
@ -144,7 +145,6 @@ class Runner(object):
|
|||
self.basedir = basedir
|
||||
self.sudo = sudo
|
||||
self.sudo_pass = sudo_pass
|
||||
self.sudo_user = sudo_user
|
||||
self.is_playbook = is_playbook
|
||||
|
||||
euid = pwd.getpwuid(os.geteuid())[0]
|
||||
|
@ -625,8 +625,8 @@ class Runner(object):
|
|||
|
||||
def _exec_command(self, conn, cmd, tmp, sudoable=False):
|
||||
''' execute a command string over SSH, return the output '''
|
||||
|
||||
stdin, stdout, stderr = conn.exec_command(cmd, tmp, sudoable=sudoable)
|
||||
sudo_user = self.sudo_user
|
||||
stdin, stdout, stderr = conn.exec_command(cmd, tmp, sudo_user,sudoable=sudoable)
|
||||
err=None
|
||||
out=None
|
||||
if type(stderr) != str:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue