Skip to content

Commit

Permalink
[thermalctld] Fix 'NameError("name 'chassis' is not defined")' error …
Browse files Browse the repository at this point in the history
…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")`
  • Loading branch information
noaOrMlnx authored Apr 7, 2021
1 parent 7f01b2c commit 0bd9f69
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions sonic-thermalctld/scripts/thermalctld
Original file line number Diff line number Diff line change
Expand Up @@ -745,18 +745,18 @@ class ThermalControlDaemon(daemon_base.DaemonBase):

self.wait_time = self.INTERVAL

chassis = sonic_platform.platform.Platform().get_chassis()
self.chassis = sonic_platform.platform.Platform().get_chassis()

self.thermal_monitor = ThermalMonitor(chassis)
self.thermal_monitor = ThermalMonitor(self.chassis)
self.thermal_monitor.task_run()

self.thermal_manager = None
try:
self.thermal_manager = chassis.get_thermal_manager()
self.thermal_manager = self.chassis.get_thermal_manager()
if self.thermal_manager:
self.thermal_manager.initialize()
self.thermal_manager.load(ThermalControlDaemon.POLICY_FILE)
self.thermal_manager.init_thermal_algorithm(chassis)
self.thermal_manager.init_thermal_algorithm(self.chassis)
except NotImplementedError:
self.log_warning('Thermal manager is not supported on this platform')
except Exception as e:
Expand Down Expand Up @@ -810,7 +810,7 @@ class ThermalControlDaemon(daemon_base.DaemonBase):
begin = time.time()
try:
if self.thermal_manager:
self.thermal_manager.run_policy(chassis)
self.thermal_manager.run_policy(self.chassis)
except Exception as e:
self.log_error('Caught exception while running thermal policy - {}'.format(repr(e)))

Expand Down

0 comments on commit 0bd9f69

Please sign in to comment.