Skip to content

Commit 3a3ae37

Browse files
authored
[S6000] Fix 'show interface status' CLI needs sudo permission (sonic-net#20384)
Why I did it CLI crashes without sudo permission on Dell 6000 platform How I did it Add check to read eeprom only if user has root permission How to verify it Verified the CLI "show interface status" does not crash if user is not root Signed-off-by: Prince George <prgeor@microsoft.com>
1 parent b62d018 commit 3a3ae37

File tree

1 file changed

+2
-1
lines changed
  • platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform

1 file changed

+2
-1
lines changed

platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/eeprom.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818

1919
try:
20+
import os
2021
import binascii
2122
import redis
2223
import struct
@@ -304,7 +305,7 @@ def __init__(self, is_plugin=False):
304305
super(EepromS6000, self).__init__(self.eeprom_path, None, 0, '', True)
305306

306307
if not is_plugin:
307-
self.eeprom_data = self.read_eeprom()
308+
self.eeprom_data = "N/A" if os.geteuid() != 0 else self.read_eeprom()
308309

309310
def _is_valid_block_checksum(self, e):
310311
crc = self.compute_dell_crc(e[:-2])

0 commit comments

Comments
 (0)