Skip to content

Commit 2e547e9

Browse files
bingwang-mssanthosh-kt
authored andcommitted
[celestica/dx010]: Fix incorrect path for voltage, current and power. (sonic-net#6128)
Fixes sonic-net#6126. There is a bug in getting the path of voltage, current and power. The list object is directly converted to string to format the file path. As a result, read_txt_file will get None value and a WARNING will be recorded. This commit fix the issue. Signed-off-by: bingwang <[email protected]>
1 parent 0d99d09 commit 2e547e9

File tree

2 files changed

+6
-6
lines changed
  • device/celestica
    • x86_64-cel_e1031-r0/sonic_platform
    • x86_64-cel_seastone-r0/sonic_platform

2 files changed

+6
-6
lines changed

device/celestica/x86_64-cel_e1031-r0/sonic_platform/psu.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def get_voltage(self):
8282
if vout_label_path:
8383
dir_name = os.path.dirname(vout_label_path)
8484
basename = os.path.basename(vout_label_path)
85-
in_num = list(filter(str.isdigit, basename))
85+
in_num = ''.join(list(filter(str.isdigit, basename)))
8686
vout_path = os.path.join(
8787
dir_name, voltage_name.format(in_num))
8888
vout_val = self.__read_txt_file(vout_path)
@@ -105,7 +105,7 @@ def get_current(self):
105105
if curr_label_path:
106106
dir_name = os.path.dirname(curr_label_path)
107107
basename = os.path.basename(curr_label_path)
108-
cur_num = list(filter(str.isdigit, basename))
108+
cur_num = ''.join(list(filter(str.isdigit, basename)))
109109
cur_path = os.path.join(
110110
dir_name, current_name.format(cur_num))
111111
cur_val = self.__read_txt_file(cur_path)
@@ -128,7 +128,7 @@ def get_power(self):
128128
if pw_label_path:
129129
dir_name = os.path.dirname(pw_label_path)
130130
basename = os.path.basename(pw_label_path)
131-
pw_num = list(filter(str.isdigit, basename))
131+
pw_num = ''.join(list(filter(str.isdigit, basename)))
132132
pw_path = os.path.join(
133133
dir_name, current_name.format(pw_num))
134134
pw_val = self.__read_txt_file(pw_path)

device/celestica/x86_64-cel_seastone-r0/sonic_platform/psu.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def get_voltage(self):
9292
if vout_label_path:
9393
dir_name = os.path.dirname(vout_label_path)
9494
basename = os.path.basename(vout_label_path)
95-
in_num = list(filter(str.isdigit, basename))
95+
in_num = ''.join(list(filter(str.isdigit, basename)))
9696
vout_path = os.path.join(
9797
dir_name, voltage_name.format(in_num))
9898
vout_val = self._api_helper.read_txt_file(vout_path)
@@ -115,7 +115,7 @@ def get_current(self):
115115
if curr_label_path:
116116
dir_name = os.path.dirname(curr_label_path)
117117
basename = os.path.basename(curr_label_path)
118-
cur_num = list(filter(str.isdigit, basename))
118+
cur_num = ''.join(list(filter(str.isdigit, basename)))
119119
cur_path = os.path.join(
120120
dir_name, current_name.format(cur_num))
121121
cur_val = self._api_helper.read_txt_file(cur_path)
@@ -138,7 +138,7 @@ def get_power(self):
138138
if pw_label_path:
139139
dir_name = os.path.dirname(pw_label_path)
140140
basename = os.path.basename(pw_label_path)
141-
pw_num = list(filter(str.isdigit, basename))
141+
pw_num = ''.join(list(filter(str.isdigit, basename)))
142142
pw_path = os.path.join(
143143
dir_name, current_name.format(pw_num))
144144
pw_val = self._api_helper.read_txt_file(pw_path)

0 commit comments

Comments
 (0)