Skip to content

Commit 0bd9f69

Browse files
authored
[thermalctld] Fix 'NameError("name 'chassis' is not defined")' error in log (sonic-net#170)
Changed the chassis definition to be a part of the class do the chassis will be found in run() function Without the change, an error appears in syslog: `ERR pmon#thermalctld: Caught exception while running thermal policy - NameError("name 'chassis' is not defined")`
1 parent 7f01b2c commit 0bd9f69

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

sonic-thermalctld/scripts/thermalctld

+5-5
Original file line numberDiff line numberDiff line change
@@ -745,18 +745,18 @@ class ThermalControlDaemon(daemon_base.DaemonBase):
745745

746746
self.wait_time = self.INTERVAL
747747

748-
chassis = sonic_platform.platform.Platform().get_chassis()
748+
self.chassis = sonic_platform.platform.Platform().get_chassis()
749749

750-
self.thermal_monitor = ThermalMonitor(chassis)
750+
self.thermal_monitor = ThermalMonitor(self.chassis)
751751
self.thermal_monitor.task_run()
752752

753753
self.thermal_manager = None
754754
try:
755-
self.thermal_manager = chassis.get_thermal_manager()
755+
self.thermal_manager = self.chassis.get_thermal_manager()
756756
if self.thermal_manager:
757757
self.thermal_manager.initialize()
758758
self.thermal_manager.load(ThermalControlDaemon.POLICY_FILE)
759-
self.thermal_manager.init_thermal_algorithm(chassis)
759+
self.thermal_manager.init_thermal_algorithm(self.chassis)
760760
except NotImplementedError:
761761
self.log_warning('Thermal manager is not supported on this platform')
762762
except Exception as e:
@@ -810,7 +810,7 @@ class ThermalControlDaemon(daemon_base.DaemonBase):
810810
begin = time.time()
811811
try:
812812
if self.thermal_manager:
813-
self.thermal_manager.run_policy(chassis)
813+
self.thermal_manager.run_policy(self.chassis)
814814
except Exception as e:
815815
self.log_error('Caught exception while running thermal policy - {}'.format(repr(e)))
816816

0 commit comments

Comments
 (0)