Skip to content

Commit ad735d1

Browse files
authored
make portstat, teamshow, aclshow runnable by normal user (#47)
1 parent 7f44592 commit ad735d1

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

scripts/aclshow

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class AclStat(object):
6161
self.table_list = tables.split(",")
6262

6363
# Set up db connections
64-
self.db = swsssdk.SonicV2Connector()
64+
self.db = swsssdk.SonicV2Connector(host="127.0.0.1")
6565
self.db.connect(self.db.APPL_DB)
6666
self.db.connect(self.db.COUNTERS_DB)
6767

scripts/portstat

+1-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ PORT_STATUS_FIELD = "oper_status"
5555

5656
class Portstat(object):
5757
def __init__(self):
58-
self.db = swsssdk.SonicV2Connector()
58+
self.db = swsssdk.SonicV2Connector(host='127.0.0.1')
5959
self.db.connect(self.db.COUNTERS_DB)
6060
self.db.connect(self.db.APPL_DB)
6161

@@ -346,9 +346,6 @@ Examples:
346346
wait_time_in_seconds = args.period
347347
print_all = args.all
348348

349-
if not os.geteuid() == 0:
350-
raise RuntimeError("must be root to run")
351-
352349
if tag_name is not None:
353350
cnstat_file = uid + "-" + tag_name
354351
else:

scripts/teamshow

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Teamshow(object):
3939
self.summary = {}
4040
self.err = None
4141
# setup db connection
42-
self.db = swsssdk.SonicV2Connector()
42+
self.db = swsssdk.SonicV2Connector(host="127.0.0.1")
4343
self.db.connect(self.db.APPL_DB)
4444

4545
def get_portchannel_names(self):

0 commit comments

Comments
 (0)