1919"""Package containing SSHClient class."""
2020
2121import sys
22- if 'threading' in sys .modules :
23- del sys .modules ['threading' ]
24- import gevent
25- from gevent import monkey
26- monkey .patch_all ()
22+ from gevent import sleep
2723import logging
2824import paramiko
2925from paramiko .ssh_exception import ChannelException as channel_exception
@@ -139,7 +135,7 @@ def _connect_tunnel(self):
139135 proxy_channel = self .proxy_client .get_transport ().\
140136 open_channel ('direct-tcpip' , (self .host , self .port ,),
141137 ('127.0.0.1' , 0 ))
142- gevent . sleep (0 )
138+ sleep (0 )
143139 return self ._connect (self .client , self .host , self .port , sock = proxy_channel )
144140 except channel_exception , ex :
145141 error_type = ex .args [1 ] if len (ex .args ) > 1 else ex .args [0 ]
@@ -164,7 +160,7 @@ def _connect(self, client, host, port, sock=None, retries=1):
164160 logger .error ("Could not resolve host '%s' - retry %s/%s" ,
165161 self .host , retries , self .num_retries )
166162 while retries < self .num_retries :
167- gevent . sleep (5 )
163+ sleep (5 )
168164 return self ._connect (client , host , port , sock = sock ,
169165 retries = retries + 1 )
170166 raise UnknownHostException ("Unknown host %s - %s - retry %s/%s" ,
@@ -174,7 +170,7 @@ def _connect(self, client, host, port, sock=None, retries=1):
174170 logger .error ("Error connecting to host '%s:%s' - retry %s/%s" ,
175171 self .host , self .port , retries , self .num_retries )
176172 while retries < self .num_retries :
177- gevent . sleep (5 )
173+ sleep (5 )
178174 return self ._connect (client , host , port , sock = sock ,
179175 retries = retries + 1 )
180176 error_type = ex .args [1 ] if len (ex .args ) > 1 else ex .args [0 ]
@@ -231,7 +227,7 @@ def exec_command(self, command, sudo=False, user=None, **kwargs):
231227 logger .debug ("Running command %s on %s" , command , self .host )
232228 channel .exec_command (command , ** kwargs )
233229 logger .debug ("Command started" )
234- gevent . sleep (0 )
230+ sleep (0 )
235231 return channel , self .host , stdout , stderr
236232
237233 def _read_output_buffer (self , output_buffer , prefix = '' ):
0 commit comments