Skip to content

Commit

Permalink
Revert "[Mellanox]Check dmi file permission before access (#11309)"
Browse files Browse the repository at this point in the history
This reverts commit 187f351.
  • Loading branch information
yxieca committed Jul 6, 2022
1 parent 7d06c7f commit 296b21e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
3 changes: 0 additions & 3 deletions platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,6 @@ def _parse_dmi(self, filename):
"""
result = {}
try:
if not os.access(filename, os.R_OK):
return result

with open(filename, "rb") as fileobj:
data = fileobj.read()

Expand Down
13 changes: 0 additions & 13 deletions platform/mellanox/mlnx-platform-api/tests/test_chassis.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,16 +267,3 @@ def test_module(self):
module_list = chassis.get_all_modules()
assert len(module_list) == 3
assert chassis.module_initialized_count == 3

def test_revision_permission(self):
old_dmi_file = sonic_platform.chassis.DMI_FILE
#Override the dmi file
sonic_platform.chassis.DMI_FILE = "/tmp/dmi_file"
new_dmi_file = sonic_platform.chassis.DMI_FILE
os.system("touch " + new_dmi_file)
os.system("chmod -r " + new_dmi_file)
chassis = Chassis()
rev = chassis.get_revision()
sonic_platform.chassis.DMI_FILE = old_dmi_file
os.system("rm -f " + new_dmi_file)
assert rev == "N/A"

0 comments on commit 296b21e

Please sign in to comment.