From 5d71ac6373197c0aa0202bd30b7110a4f338a614 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Tue, 9 May 2017 21:37:32 +0000 Subject: [PATCH 1/2] make portstat runnable by normal user --- scripts/portstat | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/portstat b/scripts/portstat index 9a29fa14e5..2345fcd823 100755 --- a/scripts/portstat +++ b/scripts/portstat @@ -55,7 +55,7 @@ PORT_STATUS_FIELD = "oper_status" class Portstat(object): def __init__(self): - self.db = swsssdk.SonicV2Connector() + self.db = swsssdk.SonicV2Connector(host='127.0.0.1') self.db.connect(self.db.COUNTERS_DB) self.db.connect(self.db.APPL_DB) @@ -346,9 +346,6 @@ Examples: wait_time_in_seconds = args.period print_all = args.all - if not os.geteuid() == 0: - raise RuntimeError("must be root to run") - if tag_name is not None: cnstat_file = uid + "-" + tag_name else: From e96cc0fd2f337fe33f016cae35b0049027b19823 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Wed, 10 May 2017 04:27:49 +0000 Subject: [PATCH 2/2] make teamshow and aclshow runnable by normal user --- scripts/aclshow | 2 +- scripts/teamshow | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/aclshow b/scripts/aclshow index e89569a20b..f1e1ef96bf 100755 --- a/scripts/aclshow +++ b/scripts/aclshow @@ -61,7 +61,7 @@ class AclStat(object): self.table_list = tables.split(",") # Set up db connections - self.db = swsssdk.SonicV2Connector() + self.db = swsssdk.SonicV2Connector(host="127.0.0.1") self.db.connect(self.db.APPL_DB) self.db.connect(self.db.COUNTERS_DB) diff --git a/scripts/teamshow b/scripts/teamshow index 0583c2b419..6c988a7c3b 100755 --- a/scripts/teamshow +++ b/scripts/teamshow @@ -39,7 +39,7 @@ class Teamshow(object): self.summary = {} self.err = None # setup db connection - self.db = swsssdk.SonicV2Connector() + self.db = swsssdk.SonicV2Connector(host="127.0.0.1") self.db.connect(self.db.APPL_DB) def get_portchannel_names(self):