@@ -146,8 +146,7 @@ async def initialize(self, **kwargs) -> TNode:
146146 passphrase )
147147 if not self .jump_host_key :
148148 raise SqPollerConfError ('Unable to read private key file'
149- f' at { pvtkey_file } '
150- )
149+ f' at { pvtkey_file } ' )
151150 else :
152151 self .jump_host = None
153152 self .jump_host_key = None
@@ -463,6 +462,15 @@ async def _detect_node_type(self):
463462 # that sets the device type
464463 devtype = self .devtype
465464 except Exception :
465+ self .logger .exception (f'{ self .address } :{ self .port } : Node '
466+ 'discovery failed due to exception' )
467+ # All the exceptions related to timeouts and authentication
468+ # problems are already catched inside. If we get an
469+ # exception here, this is unexpected and most likely something
470+ # went wrong with the command output parsing.
471+ # In this case there is not point in retrying discovery, it is
472+ # likely a bug.
473+ self ._retry = 0
466474 devtype = None
467475
468476 if not devtype :
@@ -840,7 +848,6 @@ async def _exec_cmd(self, service_callback, cmd_list, cb_token,
840848 if only_one is True, commands are executed until the first one that
841849 succeeds, and the rest are ignored.
842850 '''
843-
844851 if self .transport == "ssh" :
845852 await self ._ssh_gather (service_callback , cmd_list , cb_token ,
846853 oformat , timeout , only_one )
@@ -1220,7 +1227,7 @@ async def _rest_gather(self, service_callback, cmd_list, cb_token,
12201227 result .append (self ._create_error (cmd ))
12211228 self .logger .error (
12221229 f"{ self .transport } ://{ self .hostname } :{ self .port } : Unable "
1223- "to communicate with node due to str(e)" )
1230+ f "to communicate with node due to { str (e )} " )
12241231
12251232 await service_callback (result , cb_token )
12261233
@@ -1331,8 +1338,8 @@ async def _init_rest(self):
13311338 except Exception as e :
13321339 self .current_exception = e
13331340 self .logger .error (
1334- "{self.transport}://{self.hostname}:{self.port}: Unable to "
1335- " communicate with node due to {str(e)}" )
1341+ f "{ self .transport } ://{ self .hostname } :{ self .port } : Unable "
1342+ f"to communicate with node due to { str (e )} " )
13361343
13371344 async def _rest_gather (self , service_callback , cmd_list , cb_token ,
13381345 oformat = 'json' , timeout = None ):
@@ -1372,8 +1379,8 @@ async def _rest_gather(self, service_callback, cmd_list, cb_token,
13721379 self .current_exception = e
13731380 result .append (self ._create_error (cmd_list ))
13741381 self .logger .error (
1375- "{self.transport}://{self.hostname}:{self.port}: Unable "
1376- "to communicate with node due to {str(e)}" )
1382+ f "{ self .transport } ://{ self .hostname } :{ self .port } : Unable "
1383+ f "to communicate with node due to { str (e )} " )
13771384
13781385 await service_callback (result , cb_token )
13791386
@@ -1700,10 +1707,10 @@ async def _ssh_gather(self, service_callback, cmd_list, cb_token, oformat,
17001707 await self ._close_connection ()
17011708 self .logger .debug ("Closed conn successfully for "
17021709 f"{ self .hostname } " )
1703- except Exception as e1 :
1710+ except Exception as close_exc :
17041711 self .logger .error (
17051712 f"Caught an exception closing { self .hostname } "
1706- f" for { cmd } : { e1 } " )
1713+ f" for { cmd } : { close_exc } " )
17071714 else :
17081715 self .logger .error (
17091716 f"Unable to connect to { self .hostname } { cmd } "
0 commit comments