Skip to content

Commit 7424a45

Browse files
update phy entity tables to account for modified psu key naming (sonic-net#640)
Description Modify every instance of PSU parent naming to attempt to call the get_name API from the PSU/parent object, falling back to the prior implemented default behavior in the case that the API is not yet implemented by the vendor. Motivation and Context Issue raised: sonic-net#638, the key changes that took place previously on PSUD missing updating their associated phy entity tables in thermalctld. This PR makes the changes to account for this change.
1 parent 1eb3875 commit 7424a45

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

sonic-thermalctld/scripts/thermalctld

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ class FanUpdater(logger.Logger):
297297
"""
298298
drawer_name = NOT_AVAILABLE if fan_type != FanType.DRAWER else str(try_get(parent.get_name))
299299
if fan_type == FanType.PSU:
300-
parent_name = 'PSU {}'.format(parent_index + 1)
300+
parent_name = try_get(parent.get_name, default='PSU {}'.format(parent_index + 1))
301301
elif fan_type == FanType.MODULE:
302302
parent_name = try_get(parent.get_name, default='Module {}'.format(parent_index + 1))
303303
else:
@@ -600,7 +600,7 @@ class TemperatureUpdater(logger.Logger):
600600
self._refresh_temperature_status(CHASSIS_INFO_KEY, thermal, index)
601601

602602
for psu_index, psu in enumerate(self.chassis.get_all_psus()):
603-
parent_name = 'PSU {}'.format(psu_index + 1)
603+
parent_name = try_get(psu.get_name, default='PSU {}'.format(psu_index + 1))
604604
if psu.get_presence():
605605
for thermal_index, thermal in enumerate(psu.get_all_thermals()):
606606
if self.task_stopping_event.is_set():
@@ -641,7 +641,7 @@ class TemperatureUpdater(logger.Logger):
641641

642642
for psu_index, psu in enumerate(module.get_all_psus()):
643643
if psu.get_presence():
644-
psu_name = '{} PSU {}'.format(module_name, psu_index + 1)
644+
psu_name = try_get(psu.get_name, default='{} PSU {}'.format(module_name, psu_index + 1))
645645
for thermal_index, thermal in enumerate(psu.get_all_thermals()):
646646
if self.task_stopping_event.is_set():
647647
return

0 commit comments

Comments
 (0)