@ -40,6 +40,7 @@ from binascii import hexlify
from ansible . compat . six import iteritems
from ansible . compat . six import iteritems
from ansible import constants as C
from ansible import constants as C
from ansible . compat . six . moves import input
from ansible . errors import AnsibleError , AnsibleConnectionFailure , AnsibleFileNotFound
from ansible . errors import AnsibleError , AnsibleConnectionFailure , AnsibleFileNotFound
from ansible . plugins . connection import ConnectionBase
from ansible . plugins . connection import ConnectionBase
from ansible . utils . path import makedirs_safe
from ansible . utils . path import makedirs_safe
@ -100,7 +101,7 @@ class MyAddPolicy(object):
fingerprint = hexlify ( key . get_fingerprint ( ) )
fingerprint = hexlify ( key . get_fingerprint ( ) )
ktype = key . get_name ( )
ktype = key . get_name ( )
inp = raw_ input( AUTHENTICITY_MSG % ( hostname , ktype , fingerprint ) )
inp = input( AUTHENTICITY_MSG % ( hostname , ktype , fingerprint ) )
sys . stdin = old_stdin
sys . stdin = old_stdin
self . connection . connection_unlock ( )
self . connection . connection_unlock ( )
@ -274,9 +275,9 @@ class Connection(ConnectionBase):
cmd = to_bytes ( cmd , errors = ' strict ' )
cmd = to_bytes ( cmd , errors = ' strict ' )
no_prompt_out = ' '
no_prompt_out = b ' '
no_prompt_err = ' '
no_prompt_err = b ' '
become_output = ' '
become_output = b ' '
try :
try :
chan . exec_command ( cmd )
chan . exec_command ( cmd )
@ -317,8 +318,8 @@ class Connection(ConnectionBase):
except socket . timeout :
except socket . timeout :
raise AnsibleError ( ' ssh timed out waiting for privilege escalation. \n ' + become_output )
raise AnsibleError ( ' ssh timed out waiting for privilege escalation. \n ' + become_output )
stdout = ' ' . join ( chan . makefile ( ' rb ' , bufsize ) )
stdout = b ' ' . join ( chan . makefile ( ' rb ' , bufsize ) )
stderr = ' ' . join ( chan . makefile_stderr ( ' rb ' , bufsize ) )
stderr = b ' ' . join ( chan . makefile_stderr ( ' rb ' , bufsize ) )
return ( chan . recv_exit_status ( ) , no_prompt_out + stdout , no_prompt_out + stderr )
return ( chan . recv_exit_status ( ) , no_prompt_out + stdout , no_prompt_out + stderr )