Skip to content

Commit

Permalink
[Celestica] Ensure concrete platform API classes call base class init…
Browse files Browse the repository at this point in the history
…ializer (#6852)

In preparation for the merging of sonic-net/sonic-platform-common#173, which properly defines class and instance members in the Platform API base classes.

It is proper object-oriented methodology to call the base class initializer, even if it is only the default initializer. This also future-proofs the potential addition of custom initializers in the base classes down the road.
  • Loading branch information
jleveque authored Feb 25, 2021
1 parent ac15a42 commit c617825
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class Thermal(ThermalBase):
SS_CONFIG_PATH = "/usr/share/sonic/device/x86_64-cel_e1031-r0/sensors.conf"

def __init__(self, thermal_index):
ThermalBase.__init__(self)

self.index = thermal_index

# Add thermal name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
class Watchdog(WatchdogBase):

def __init__(self):
WatchdogBase.__init__(self)

self.watchdog, self.wdt_main_dev_name = self._get_wdt()
self.status_path = "/sys/class/watchdog/%s/status" % self.wdt_main_dev_name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class Thermal(ThermalBase):
SS_CONFIG_PATH = "/usr/share/sonic/device/x86_64-cel_seastone-r0/sensors.conf"

def __init__(self, thermal_index, airflow):
ThermalBase.__init__(self)
self.index = thermal_index
self._api_helper = APIHelper()
self._airflow = airflow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
class Watchdog(WatchdogBase):

def __init__(self):
WatchdogBase.__init__(self)

# Init helper
self._api_helper = APIHelper()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
class Watchdog(WatchdogBase):

def __init__(self):
WatchdogBase.__init__(self)

self._api_common = Common()

# Init cpld reg path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Fan(FanBase):
"""Platform-specific Fan class"""

def __init__(self, fan_tray_index, fan_index=0, is_psu_fan=False, psu_index=0):
FanBase.__init__(self)
self.fan_index = fan_index
self.fan_tray_index = fan_tray_index
self.is_psu_fan = is_psu_fan
Expand Down

0 comments on commit c617825

Please sign in to comment.