Skip to content

Commit

Permalink
[S6000] Fix 'show interface status' CLI needs sudo permission (sonic-…
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
prgeor authored and mssonicbld committed Oct 18, 2024
1 parent bea5b9b commit 7ed0dcd
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@


try:
import os
import binascii
import redis
import struct
Expand Down Expand Up @@ -304,7 +305,7 @@ def __init__(self, is_plugin=False):
super(EepromS6000, self).__init__(self.eeprom_path, None, 0, '', True)

if not is_plugin:
self.eeprom_data = self.read_eeprom()
self.eeprom_data = "N/A" if os.geteuid() != 0 else self.read_eeprom()

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

0 comments on commit 7ed0dcd

Please sign in to comment.