1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix for older version of sudo + some changes to imports so tests are happy

This commit is contained in:
Michael DeHaan 2012-05-31 21:44:30 -04:00
parent 634cf9aaba
commit 99430fa0a3
3 changed files with 6 additions and 6 deletions

View file

@ -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

View file

@ -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 '''

View file

@ -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)