Skip to content

Commit

Permalink
remove get_platform_path()
Browse files Browse the repository at this point in the history
  • Loading branch information
roger530-ho authored and PJHsieh committed Sep 5, 2024
1 parent e9498b0 commit 4b3a0e0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@

HOST_CHK_CMD = ["docker"]
EMPTY_STRING = ""
HOST_PLATFORM_PATH = "/usr/share/sonic/device/{}/"
PMON_PLATFORM_PATH = "/usr/share/sonic/platform/"
MACHINE_CONF_FILE = "/host/machine.conf"


class APIHelper():
Expand Down Expand Up @@ -103,19 +100,6 @@ def ipmi_set_ss_thres(self, id, threshold_key, value):
status = False
return status, result

def get_platform_path(self):
platform_path = PMON_PLATFORM_PATH
if self.is_host():
platform = "None"
with open(MACHINE_CONF_FILE, 'r') as file:
for line in file:
if 'onie_platform=' in line:
platform = line.strip().split('=')[1]
break
platform_path = HOST_PLATFORM_PATH.format(platform)

return platform_path


class FileLock:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

try:
from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil
from .helper import APIHelper
except ImportError as e:
raise ImportError(str(e) + "- required module not found")

Expand All @@ -18,7 +17,6 @@ class Pcie(PcieUtil):

def __init__(self, platform_path):
PcieUtil.__init__(self, platform_path)
self._api_helper = APIHelper()
self._conf_rev = self.__get_conf_rev()

def __get_conf_rev(self):
Expand All @@ -35,7 +33,6 @@ def __get_conf_rev(self):
"""
try:
import os
import json
from sonic_platform_pddf_base import pddfapi
from sonic_platform.eeprom import Eeprom

Expand All @@ -48,10 +45,9 @@ def __get_conf_rev(self):
return "N/A"

label_rev = results[2].decode('ascii')
platform_path = self._api_helper.get_platform_path()

for rev in (label_rev[:-1], label_rev):
pcie_yaml_file = os.path.join(platform_path, f"pcie_{rev}.yaml")
pcie_yaml_file = os.path.join(self.config_path, f"pcie_{rev}.yaml")
if os.path.exists(pcie_yaml_file):
return rev

Expand Down

0 comments on commit 4b3a0e0

Please sign in to comment.