Skip to content

Commit 9ce4d19

Browse files
committed
With the changes in PR:sonic-net/sonic-buildimage#5289 access to redis unix socket is given to the redis group members.
Many of sonic-util commands (especially in multi-asic) case use redis unix socket to connect to DB and thus those comamnd fails without providing sudo. This PR is continuation of PR: sonic-net/sonic-buildimage#7002 where we default to use TCP for Redis if user is not root Signed-off-by: Abhishek Dosi <[email protected]>
1 parent 63c75c1 commit 9ce4d19

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/swsssdk/dbconnector.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def get_separator(db_name, namespace=None):
226226
class SonicV2Connector(object):
227227
def __init__(self, use_unix_socket_path=False, namespace=None, **kwargs):
228228
self.dbintf = DBInterface(**kwargs)
229-
self.use_unix_socket_path = use_unix_socket_path
229+
self.use_unix_socket_path = True if use_unix_socket_path and os.getuid() == 0 else False
230230

231231
"""If the user don't give the namespace as input, it refers to the local namespace
232232
where this application is run. (It could be a network namespace or linux host namesapce)

0 commit comments

Comments
 (0)