Skip to content

Commit

Permalink
sudo not required explicitly as /bin/ip netns identify is part of REA…
Browse files Browse the repository at this point in the history
…D_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
  • Loading branch information
judyjoseph authored Aug 18, 2023
1 parent a4098de commit 0bd8c3b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/sonic-py-common/sonic_py_common/multi_asic.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def get_current_namespace(pid=None):
"""

net_namespace = None
command = ["sudo", '/bin/ip', 'netns', 'identify', "{}".format(os.getpid() if not pid else pid)]
command = ['/bin/ip', 'netns', 'identify', "{}".format(os.getpid() if not pid else pid)]
proc = subprocess.Popen(command,
stdout=subprocess.PIPE,
universal_newlines=True,
Expand Down

0 comments on commit 0bd8c3b

Please sign in to comment.