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
This commit is contained in:
judyjoseph 2023-08-18 14:25:41 -07:00 committed by GitHub
parent a4098de529
commit 0bd8c3bf11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -157,7 +157,7 @@ def get_current_namespace(pid=None):
""" """
net_namespace = 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, proc = subprocess.Popen(command,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
universal_newlines=True, universal_newlines=True,