Skip to content

Commit

Permalink
Remove run
Browse files Browse the repository at this point in the history
Signed-off-by: maipbui <maibui@microsoft.com>
  • Loading branch information
maipbui committed Oct 5, 2022
1 parent 1e62cff commit c35ec09
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def get_low_power_mode(self, port_num):
lpm_cmd = ["docker", "exec", "syncd", "python", "/usr/share/sonic/platform/plugins/sfplpmget.py", str(port_num)]

try:
output = subprocess.run(lpm_cmd, universal_newlines=True, capture_output=True, check=True).stdout
output = subprocess.check_output(lpm_cmd, universal_newlines=True)
if 'LPM ON' in output:
return True
except subprocess.CalledProcessError as e:
Expand All @@ -182,7 +182,7 @@ def set_low_power_mode(self, port_num, lpmode):

# Set LPM
try:
subprocess.run(lpm_cmd, check=True, universal_newlines=True, capture_output=True).stdout
subprocess.check_output(lpm_cmd, universal_newlines=True)
except subprocess.CalledProcessError as e:
print("Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output))
return False
Expand All @@ -197,7 +197,7 @@ def reset(self, port_num):
lpm_cmd = ["docker", "exec", "syncd", "python", "/usr/share/sonic/platform/plugins/sfpreset.py", str(port_num)]

try:
subprocess.run(lpm_cmd, check=True, universal_newlines=True, capture_output=True).stdout
subprocess.check_output(lpm_cmd, universal_newlines=True)
return True
except subprocess.CalledProcessError as e:
print("Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output))
Expand Down Expand Up @@ -269,7 +269,7 @@ def _read_eeprom_specific_bytes_via_ethtool(self, port_num, offset, num_bytes):
eeprom_raw = []
ethtool_cmd = ["ethtool", "-m", sfpname, "hex", "on", "offset", str(offset), "length", str(num_bytes)]
try:
output = subprocess.run(ethtool_cmd, check=True, universal_newlines=True, capture_output=True).stdout
output = subprocess.check_output(ethtool_cmd, universal_newlines=True)
output_lines = output.splitlines()
first_line_raw = output_lines[0]
if "Offset" in first_line_raw:
Expand Down
6 changes: 3 additions & 3 deletions platform/mellanox/mlnx-platform-api/tests/test_chassis.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,12 @@ def test_revision_permission(self):
#Override the dmi file
sonic_platform.chassis.DMI_FILE = "/tmp/dmi_file"
new_dmi_file = sonic_platform.chassis.DMI_FILE
subprocess.run(["touch", new_dmi_file])
subprocess.run(["chmod", "-r", new_dmi_file])
subprocess.call(["touch", new_dmi_file])
subprocess.call(["chmod", "-r", new_dmi_file])
chassis = Chassis()
rev = chassis.get_revision()
sonic_platform.chassis.DMI_FILE = old_dmi_file
subprocess.run(["rm", "-f", new_dmi_file])
subprocess.call(["rm", "-f", new_dmi_file])
assert rev == "N/A"

def test_get_port_or_cage_type(self):
Expand Down

0 comments on commit c35ec09

Please sign in to comment.