Fix for older version of sudo + some changes to imports so tests are happy
This commit is contained in:
parent
bc715d065f
commit
78d269d038
3 changed files with 6 additions and 6 deletions
|
@ -32,11 +32,11 @@ import getpass
|
|||
import codecs
|
||||
|
||||
import ansible.constants as C
|
||||
import connection
|
||||
import ansible.inventory
|
||||
from ansible import utils
|
||||
from ansible import errors
|
||||
from ansible.runner import poller
|
||||
import poller
|
||||
import connection
|
||||
from ansible import callbacks as ans_callbacks
|
||||
|
||||
HAS_ATFORK=True
|
||||
|
|
|
@ -29,8 +29,8 @@ import pipes
|
|||
import socket
|
||||
import random
|
||||
|
||||
from ansible.runner.connection import local
|
||||
from ansible.runner.connection import paramiko_ssh
|
||||
import local
|
||||
import paramiko_ssh
|
||||
|
||||
class Connection(object):
|
||||
''' Handles abstract connections to remote hosts '''
|
||||
|
|
|
@ -99,8 +99,8 @@ class ParamikoConnection(object):
|
|||
# the -p option.
|
||||
randbits = ''.join(chr(random.randint(ord('a'), ord('z'))) for x in xrange(32))
|
||||
prompt = '[sudo via ansible, key=%s] password: ' % randbits
|
||||
sudocmd = 'sudo -k -p "%s" -u %s -- "$SHELL" -c %s' % (prompt,
|
||||
sudo_user, pipes.quote(cmd))
|
||||
sudocmd = 'sudo -k && sudo -p "%s" -u %s -- "$SHELL" -c %s' % (
|
||||
prompt, sudo_user, pipes.quote(cmd))
|
||||
sudo_output = ''
|
||||
try:
|
||||
chan.exec_command(sudocmd)
|
||||
|
|
Loading…
Reference in a new issue