From 1d4bf578a46fd1f53af159d7ccd5661d11bd391a Mon Sep 17 00:00:00 2001 From: "david.zagury" Date: Sun, 4 Jul 2021 14:59:53 +0300 Subject: [PATCH] [pcied] Fix pcied failure to load due to 'pcied NameError: name 'self' is not defined' --- sonic-pcied/scripts/pcied | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sonic-pcied/scripts/pcied b/sonic-pcied/scripts/pcied index 7265063ff..f88f159d1 100644 --- a/sonic-pcied/scripts/pcied +++ b/sonic-pcied/scripts/pcied @@ -10,7 +10,7 @@ import signal import sys import threading -from sonic_py_common import daemon_base, device_info +from sonic_py_common import daemon_base, device_info, logger from swsscommon import swsscommon # @@ -35,6 +35,8 @@ PCIEUTIL_LOAD_ERROR = 2 platform_pcieutil = None +log = logger.Logger(SYSLOG_IDENTIFIER) + exit_code = 0 # wrapper functions to call the platform api @@ -45,12 +47,12 @@ def load_platform_pcieutil(): from sonic_platform.pcie import Pcie _platform_pcieutil = Pcie(platform_path) except ImportError as e: - self.log_error("Failed to load platform Pcie module. Error : {}".format(str(e)), True) + log.log_notice("Failed to load platform Pcie module. Error : {}, Fallback to default module".format(str(e)), True) try: from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil _platform_pcieutil = PcieUtil(platform_path) except ImportError as e: - self.log_error("Failed to load default PcieUtil module. Error : {}".format(str(e)), True) + log.log_error("Failed to load default PcieUtil module. Error : {}".format(str(e)), True) return _platform_pcieutil def read_id_file(device_name):