From b4555b9dbd767eaf1af06c385c64ce5f6f619ee9 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 25 Feb 2021 11:06:22 -0800 Subject: [PATCH] [Mellanox] Ensure concrete platform API classes call base class initializer (#6854) In preparation for the merging of Azure/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. --- platform/mellanox/mlnx-platform-api/sonic_platform/component.py | 1 + platform/mellanox/mlnx-platform-api/sonic_platform/thermal.py | 1 + platform/mellanox/mlnx-platform-api/sonic_platform/watchdog.py | 1 + 3 files changed, 3 insertions(+) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/component.py b/platform/mellanox/mlnx-platform-api/sonic_platform/component.py index e70007e965..f2a66c6d42 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/component.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/component.py @@ -323,6 +323,7 @@ class ONIEUpdater(object): class Component(ComponentBase): def __init__(self): + super(Component, self).__init__() self.name = None self.description = None self.image_ext_name = None diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/thermal.py b/platform/mellanox/mlnx-platform-api/sonic_platform/thermal.py index c942b0d89d..b4347d5568 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/thermal.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/thermal.py @@ -373,6 +373,7 @@ class Thermal(ThermalBase): """ index should be a string for category ambient and int for other categories """ + super(Thermal, self).__init__() if category == THERMAL_DEV_CATEGORY_AMBIENT: self.name = thermal_ambient_name[index] self.index = index diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/watchdog.py b/platform/mellanox/mlnx-platform-api/sonic_platform/watchdog.py index e9694f1b2a..909ec6a888 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/watchdog.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/watchdog.py @@ -63,6 +63,7 @@ class WatchdogImplBase(WatchdogBase): Open a watchdog handle @param wd_device_path Path to watchdog device """ + super(WatchdogImplBase, self).__init__() self.watchdog_path = wd_device_path self.watchdog = os.open(self.watchdog_path, os.O_WRONLY)