Skip to content

Commit

Permalink
[celestica/dx010]: Fix incorrect path for voltage, current and power. (
Browse files Browse the repository at this point in the history
…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]>
  • Loading branch information
bingwang-ms authored and santhosh-kt committed Feb 25, 2021
1 parent 0d99d09 commit 2e547e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions device/celestica/x86_64-cel_e1031-r0/sonic_platform/psu.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def get_voltage(self):
if vout_label_path:
dir_name = os.path.dirname(vout_label_path)
basename = os.path.basename(vout_label_path)
in_num = list(filter(str.isdigit, basename))
in_num = ''.join(list(filter(str.isdigit, basename)))
vout_path = os.path.join(
dir_name, voltage_name.format(in_num))
vout_val = self.__read_txt_file(vout_path)
Expand All @@ -105,7 +105,7 @@ def get_current(self):
if curr_label_path:
dir_name = os.path.dirname(curr_label_path)
basename = os.path.basename(curr_label_path)
cur_num = list(filter(str.isdigit, basename))
cur_num = ''.join(list(filter(str.isdigit, basename)))
cur_path = os.path.join(
dir_name, current_name.format(cur_num))
cur_val = self.__read_txt_file(cur_path)
Expand All @@ -128,7 +128,7 @@ def get_power(self):
if pw_label_path:
dir_name = os.path.dirname(pw_label_path)
basename = os.path.basename(pw_label_path)
pw_num = list(filter(str.isdigit, basename))
pw_num = ''.join(list(filter(str.isdigit, basename)))
pw_path = os.path.join(
dir_name, current_name.format(pw_num))
pw_val = self.__read_txt_file(pw_path)
Expand Down
6 changes: 3 additions & 3 deletions device/celestica/x86_64-cel_seastone-r0/sonic_platform/psu.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def get_voltage(self):
if vout_label_path:
dir_name = os.path.dirname(vout_label_path)
basename = os.path.basename(vout_label_path)
in_num = list(filter(str.isdigit, basename))
in_num = ''.join(list(filter(str.isdigit, basename)))
vout_path = os.path.join(
dir_name, voltage_name.format(in_num))
vout_val = self._api_helper.read_txt_file(vout_path)
Expand All @@ -115,7 +115,7 @@ def get_current(self):
if curr_label_path:
dir_name = os.path.dirname(curr_label_path)
basename = os.path.basename(curr_label_path)
cur_num = list(filter(str.isdigit, basename))
cur_num = ''.join(list(filter(str.isdigit, basename)))
cur_path = os.path.join(
dir_name, current_name.format(cur_num))
cur_val = self._api_helper.read_txt_file(cur_path)
Expand All @@ -138,7 +138,7 @@ def get_power(self):
if pw_label_path:
dir_name = os.path.dirname(pw_label_path)
basename = os.path.basename(pw_label_path)
pw_num = list(filter(str.isdigit, basename))
pw_num = ''.join(list(filter(str.isdigit, basename)))
pw_path = os.path.join(
dir_name, current_name.format(pw_num))
pw_val = self._api_helper.read_txt_file(pw_path)
Expand Down

0 comments on commit 2e547e9

Please sign in to comment.