|
|
@ -31,6 +31,7 @@ import sys
|
|
|
|
import pipes
|
|
|
|
import pipes
|
|
|
|
import jinja2
|
|
|
|
import jinja2
|
|
|
|
import subprocess
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
import getpass
|
|
|
|
|
|
|
|
|
|
|
|
import ansible.constants as C
|
|
|
|
import ansible.constants as C
|
|
|
|
import ansible.inventory
|
|
|
|
import ansible.inventory
|
|
|
@ -931,6 +932,12 @@ class Runner(object):
|
|
|
|
if conn.user == sudo_user or conn.user == su_user:
|
|
|
|
if conn.user == sudo_user or conn.user == su_user:
|
|
|
|
sudoable = False
|
|
|
|
sudoable = False
|
|
|
|
su = False
|
|
|
|
su = False
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
# assume connection type is local if no user attribute
|
|
|
|
|
|
|
|
this_user = getpass.getuser()
|
|
|
|
|
|
|
|
if this_user == sudo_user or this_user == su_user:
|
|
|
|
|
|
|
|
sudoable = False
|
|
|
|
|
|
|
|
su = False
|
|
|
|
|
|
|
|
|
|
|
|
if su:
|
|
|
|
if su:
|
|
|
|
rc, stdin, stdout, stderr = conn.exec_command(cmd,
|
|
|
|
rc, stdin, stdout, stderr = conn.exec_command(cmd,
|
|
|
|