14
14
from sonic_py_common import daemon_base , logger
15
15
from sonic_py_common .task_base import ProcessTaskBase
16
16
except ImportError as e :
17
- raise ImportError (str (e ) + " - required module not found" )
17
+ raise ImportError (repr (e ) + " - required module not found" )
18
18
19
19
try :
20
20
from swsscommon import swsscommon
@@ -220,7 +220,7 @@ class FanUpdater(logger.Logger):
220
220
try :
221
221
self ._refresh_fan_status (drawer , fan , fan_index )
222
222
except Exception as e :
223
- self .log_warning ('Failed to update FAN status - {}' .format (e ))
223
+ self .log_warning ('Failed to update FAN status - {}' .format (repr ( e ) ))
224
224
fan_index += 1
225
225
226
226
for psu_index , psu in enumerate (self .chassis .get_all_psus ()):
@@ -229,7 +229,7 @@ class FanUpdater(logger.Logger):
229
229
try :
230
230
self ._refresh_fan_status (None , fan , fan_index , '{} FAN' .format (psu_name ), True )
231
231
except Exception as e :
232
- self .log_warning ('Failed to update PSU FAN status - {}' .format (e ))
232
+ self .log_warning ('Failed to update PSU FAN status - {}' .format (repr ( e ) ))
233
233
234
234
self ._update_led_color ()
235
235
@@ -357,7 +357,7 @@ class FanUpdater(logger.Logger):
357
357
('led_status' , str (try_get (fan_status .fan .get_status_led )))
358
358
])
359
359
except Exception as e :
360
- self .log_warning ('Failed to get led status for fan' )
360
+ self .log_warning ('Failed to get led status for fan - {}' . format ( repr ( e )) )
361
361
fvs = swsscommon .FieldValuePairs ([
362
362
('led_status' , NOT_AVAILABLE )
363
363
])
@@ -494,7 +494,7 @@ class TemperatureUpdater(logger.Logger):
494
494
try :
495
495
self ._refresh_temperature_status (thermal , index )
496
496
except Exception as e :
497
- self .log_warning ('Failed to update thermal status - {}' .format (e ))
497
+ self .log_warning ('Failed to update thermal status - {}' .format (repr ( e ) ))
498
498
499
499
self .log_debug ("End temperature updating" )
500
500
@@ -664,8 +664,10 @@ class ThermalControlDaemon(daemon_base.DaemonBase):
664
664
thermal_manager .initialize ()
665
665
thermal_manager .load (ThermalControlDaemon .POLICY_FILE )
666
666
thermal_manager .init_thermal_algorithm (chassis )
667
+ except NotImplementedError :
668
+ self .log_warning ('Thermal manager is not supported on this platform.' )
667
669
except Exception as e :
668
- self .log_error ('Caught exception while initializing thermal manager - {}' .format (e ))
670
+ self .log_error ('Caught exception while initializing thermal manager - {}' .format (repr ( e ) ))
669
671
670
672
wait_time = ThermalControlDaemon .INTERVAL
671
673
while not self .stop_event .wait (wait_time ):
@@ -674,7 +676,7 @@ class ThermalControlDaemon(daemon_base.DaemonBase):
674
676
if thermal_manager :
675
677
thermal_manager .run_policy (chassis )
676
678
except Exception as e :
677
- self .log_error ('Caught exception while running thermal policy - {}' .format (e ))
679
+ self .log_error ('Caught exception while running thermal policy - {}' .format (repr ( e ) ))
678
680
elapsed = time .time () - begin
679
681
if elapsed < ThermalControlDaemon .INTERVAL :
680
682
wait_time = ThermalControlDaemon .INTERVAL - elapsed
@@ -689,7 +691,7 @@ class ThermalControlDaemon(daemon_base.DaemonBase):
689
691
if thermal_manager :
690
692
thermal_manager .deinitialize ()
691
693
except Exception as e :
692
- self .log_error ('Caught exception while destroy thermal manager - {}' .format (e ))
694
+ self .log_error ('Caught exception while destroy thermal manager - {}' .format (repr ( e ) ))
693
695
694
696
thermal_monitor .task_stop ()
695
697
0 commit comments