mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fixes #5030 compare connection user and sudo user and disable sudo if identical
This commit is contained in:
parent
12ed39ef7b
commit
b6879ca2bd
1 changed files with 6 additions and 4 deletions
|
@ -763,8 +763,10 @@ class Runner(object):
|
||||||
|
|
||||||
sudo_user = self.sudo_user
|
sudo_user = self.sudo_user
|
||||||
|
|
||||||
if self.remote_user == sudo_user:
|
# compare connection user to sudo_user and disable if the same
|
||||||
sudoable = False
|
if hasattr(conn, 'user'):
|
||||||
|
if conn.user == sudo_user:
|
||||||
|
sudoable = False
|
||||||
|
|
||||||
rc, stdin, stdout, stderr = conn.exec_command(cmd, tmp, sudo_user, sudoable=sudoable, executable=executable)
|
rc, stdin, stdout, stderr = conn.exec_command(cmd, tmp, sudo_user, sudoable=sudoable, executable=executable)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue