Skip to content

Commit 0bd8c3b

Browse files
authored
sudo not required explicitly as /bin/ip netns identify is part of READ_ONLY_CMDS in sudoers file (#16115)
Why I did it Few commands in multiasic platforms when run with the "sudo ip netns exec asic0 " option was taking like 15 mins to get the o/p. This behavior of sudo getting hung was seen by just doing this jujoseph@svcstr-server-2:~ sudo ip netns exec asic0 bash jujoseph@svcstr-server-2:~ sudo ls deally sudo is not needed as we have /bin/ip netns identify present in /etc/sudoers file. Hence removing it
1 parent a4098de commit 0bd8c3b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/sonic-py-common/sonic_py_common/multi_asic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def get_current_namespace(pid=None):
157157
"""
158158

159159
net_namespace = None
160-
command = ["sudo", '/bin/ip', 'netns', 'identify', "{}".format(os.getpid() if not pid else pid)]
160+
command = ['/bin/ip', 'netns', 'identify', "{}".format(os.getpid() if not pid else pid)]
161161
proc = subprocess.Popen(command,
162162
stdout=subprocess.PIPE,
163163
universal_newlines=True,

0 commit comments

Comments
 (0)