Skip to content

Commit

Permalink
[pcied] Fix pcied failure to load due to 'pcied NameError: name 'self…
Browse files Browse the repository at this point in the history
…' is not defined'
  • Loading branch information
DavidZagury committed Jul 5, 2021
1 parent 2d2749a commit 1d4bf57
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sonic-pcied/scripts/pcied
Original file line number Diff line number Diff line change
Expand Up @@ -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

#
Expand All @@ -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
Expand All @@ -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):
Expand Down

0 comments on commit 1d4bf57

Please sign in to comment.