def debug_ssh(function):
 def wrapper(self, *args, **kwargs):
  try:
   return function(self, *args, **kwargs)
  except tempest.lib.exceptions.SSHTimeout:
   try:
    original_exception = sys.exc_info()
    caller = (test_utils.find_test_caller() or 'not found')
    if self.server:
     msg = 'Caller: %s. Timeout trying to ssh to server %s'
     LOG.debug(msg, caller, self.server)
     if (self.log_console and self.servers_client):
      try:
       msg = 'Console log for server %s: %s'
       console_log = self.servers_client.get_console_output(self.server['id'])['output']
       LOG.debug(msg, self.server['id'], console_log)
      except Exception:
       msg = 'Could not get console_log for server %s'
       LOG.debug(msg, self.server['id'])
    six.reraise(*original_exception)
   finally:
    (_, _, trace) = original_exception
    del trace
 return wrapper

def debug_ssh ( function ) : def wrapper ( self , * args , ** kwargs ) : try : return function ( self , * args , ** kwargs ) except tempest . lib . exceptions . SSHTimeout : try : original_exception = sys . exc_info ( ) caller = ( test_utils . find_test_caller ( ) or 'not found' ) if self . server : msg = 'Caller: %s. Timeout trying to ssh to server %s' LOG . debug ( msg , caller , self . server ) if ( self . log_console and self . servers_client ) : try : msg = 'Console log for server %s: %s' console_log = self . servers_client . get_console_output ( self . server [ 'id' ] ) [ 'output' ] LOG . debug ( msg , self . server [ 'id' ] , console_log ) except Exception : msg = 'Could not get console_log for server %s' LOG . debug ( msg , self . server [ 'id' ] ) six . reraise ( * original_exception ) finally : ( _ , _ , trace ) = original_exception del trace return wrapper
decorator to generate extra debug info in case off ssh failure .