sonic-buildimage/platform/mellanox/mlnx-platform-api/sonic_platform
Sudharsan Dhamal Gopalarathnam 119789719d
[202205][Mellanox]Check dmi file permission before access (#11346)
* [Mellanox]Check dmi file permission before access (#11309)

Signed-off-by: Sudharsan Dhamal Gopalarathnam sudharsand@nvidia.com

Why I did it
During the system boot up when 'show platform status' or 'show version' command is executed before STATE_DB CHASSIS_INFO table is populated, the show will try to fallback to use the platform API. The DMI file in mellanox platforms require root permission for access. So if the show commands are executed as admin or any other user, the following error log will appear in the syslog

Jun 28 17:21:25.612123 sonic ERR show: Fail to decode DMI /sys/firmware/dmi/entries/2-0/raw due to PermissionError(13, 'Permission denied')

How I did it
Check the file permission before accessing it.

How to verify it
Added UT to verify. Manually verified if the error log is not thrown.
2022-07-06 16:13:07 -07:00
..
__init__.py [Mellanox] Add NVIDIA Copyright header to "mellanox" files (#8799) 2021-10-17 19:03:02 +03:00
chassis.py [202205][Mellanox]Check dmi file permission before access (#11346) 2022-07-06 16:13:07 -07:00
component.py [Mellanox] Update NVIDIA License header for files changed since 1.1.2022 (#10289) 2022-03-23 13:19:25 +02:00
cpu_thermal_control.py [Mellanox] Add CPU thermal control for Nvidia platforms (#10202) 2022-03-21 09:54:52 -07:00
device_data.py [Mellanox] optimize platform API import time (#10815) 2022-06-09 16:50:12 +00:00
eeprom.py [Mellanox] Refactor Mellanox platform API to support dynamic port configuration (#8422) 2021-10-25 07:59:06 +03:00
fan_drawer.py [Mellanox] Refactor Mellanox platform API to support dynamic port configuration (#8422) 2021-10-25 07:59:06 +03:00
fan.py [Mellanox] Update NVIDIA License header for files changed since 1.1.2022 (#10289) 2022-03-23 13:19:25 +02:00
led.py [Mellanox] Allow user to set LED to orange (#9259) 2021-12-08 13:05:10 -08:00
module.py [Mellanox] Refactor Mellanox platform API to support dynamic port configuration (#8422) 2021-10-25 07:59:06 +03:00
pcie.py [Mellanox] Add NVIDIA Copyright header to "mellanox" files (#8799) 2021-10-17 19:03:02 +03:00
platform.py [Mellanox] Refactor Mellanox platform API to support dynamic port configuration (#8422) 2021-10-25 07:59:06 +03:00
psu.py [Mellanox] Adjust PSU voltage WA (#10619) 2022-04-22 11:02:30 +03:00
sfp_event.py [Mellanox] Update NVIDIA License header for files changed since 1.1.2022 (#10289) 2022-03-23 13:19:25 +02:00
sfp.py [Mellanox] Credo Y-cable | add more log info, checks, fix exception message (#10779) 2022-05-19 17:36:02 +03:00
thermal_actions.py [Mellanox] Update NVIDIA License header for files changed since 1.1.2022 (#10289) 2022-03-23 13:19:25 +02:00
thermal_conditions.py [Mellanox] Update NVIDIA License header for files changed since 1.1.2022 (#10289) 2022-03-23 13:19:25 +02:00
thermal_infos.py [Mellanox] Fan speed should not be 100% when PSU is powered off (#9258) 2021-11-24 14:56:00 +02:00
thermal_manager.py [Mellanox] Add CPU thermal control for Nvidia platforms (#10202) 2022-03-21 09:54:52 -07:00
thermal.py [Mellanox] Add CPU thermal control for Nvidia platforms (#10202) 2022-03-21 09:54:52 -07:00
utils.py [Mellanox] Auto correct PSU voltage threshold (WA) (#10394) 2022-04-14 08:14:40 +03:00
vpd_parser.py [Mellanox] Auto correct PSU voltage threshold (WA) (#10394) 2022-04-14 08:14:40 +03:00
watchdog.py [Mellanox] Add NVIDIA Copyright header to "mellanox" files (#8799) 2021-10-17 19:03:02 +03:00