sudo not required explicitly as /bin/ip netns identify is part of READ_ONLY_CMDS in sudoers file (#16258)

Cherry-pick PR :#16115
This commit is contained in:
judyjoseph 2023-08-25 17:02:26 -07:00 committed by GitHub
parent d19d904f6a
commit d91565ba5e
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
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,
shell=True,