Commit b6879ca2 by James Tanner

Fixes #5030 compare connection user and sudo user and disable sudo if identical

parent 12ed39ef
......@@ -762,10 +762,12 @@ class Runner(object):
executable = C.DEFAULT_EXECUTABLE
sudo_user = self.sudo_user
if self.remote_user == sudo_user:
sudoable = False
# compare connection user to sudo_user and disable if the same
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)
if type(stdout) not in [ str, unicode ]:
......
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