Skip to content

Commit bd7830b

Browse files
authored
[pcied] Remove unnecessary message and move the configuration path (sonic-net#144)
[pcied] Remove unnecessary message and move the configuration path from plugin directory to platform directory This PR fixes sonic-net#5819 and fixes sonic-net#6437. Remove unnecessary repeated message Move the configuration path from plugin directory to platform directory
1 parent 9080fda commit bd7830b

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

sonic-pcied/scripts/pcied

+6-14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python2
1+
#!/usr/bin/env python3
22

33
"""
44
pcied
@@ -41,8 +41,7 @@ class DaemonPcied(daemon_base.DaemonBase):
4141
super(DaemonPcied, self).__init__(log_identifier)
4242

4343
(platform_path, _) = device_info.get_paths_to_platform_and_hwsku_dirs()
44-
pciefilePath = os.path.join(platform_path, "plugins", PCIE_CONF_FILE)
45-
sys.path.append(os.path.abspath(pciefilePath))
44+
pciefilePath = os.path.join(platform_path, PCIE_CONF_FILE)
4645
if not os.path.exists(pciefilePath):
4746
self.log_error("Platform pcie configuration file doesn't exist! Exiting ...")
4847
sys.exit("Platform PCIe Configuration file doesn't exist!")
@@ -82,17 +81,11 @@ class DaemonPcied(daemon_base.DaemonBase):
8281
def check_pcie_devices(self):
8382
try:
8483
platform_path, _ = device_info.get_paths_to_platform_and_hwsku_dirs()
85-
platform_plugins_path = os.path.join(platform_path, "plugins")
86-
sys.path.append(os.path.abspath(platform_plugins_path))
87-
from pcieutil import PcieUtil
84+
from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil
85+
platform_pcieutil = PcieUtil(platform_path)
8886
except ImportError as e:
89-
self.log_warning("Failed to load platform-specific PcieUtil module. Falling back to the common implementation")
90-
try:
91-
from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil
92-
platform_pcieutil = PcieUtil(platform_plugins_path)
93-
except ImportError as e:
94-
self.log_error("Failed to load default PcieUtil module. Error : {}".format(str(e)), True)
95-
raise e
87+
self.log_error("Failed to load default PcieUtil module. Error : {}".format(str(e)), True)
88+
raise e
9689

9790
resultInfo = platform_pcieutil.get_pcie_check()
9891
err = 0
@@ -184,6 +177,5 @@ def main():
184177
pcied = DaemonPcied(SYSLOG_IDENTIFIER)
185178
pcied.run()
186179

187-
188180
if __name__ == '__main__':
189181
main()

0 commit comments

Comments
 (0)