Fix error in 'ip netns' parsing
Sometimes when doing worlddump would see a command line like this: sudo ip netns exec (id: ip addr This would cause an error to be seen in console.log: 2017-02-07 00:03:03.659570 | /bin/sh: 1: Syntax error: "(" unexpected This is caused by there sometimes being extra data returned from the 'ip netns' command [1]. For example it might look like: qrouter-0805fd7d-c493-4fa6-82ca-1c6c9b23cd9e (id: 1) qdhcp-bb2cc6ae-2ae8-474f-adda-a94059b872b5 (id: 0) [1] https://lwn.net/Articles/629715/ Change-Id: Icece442023125ef55696b8d92a975d37e358b1b4 Closes-Bug: 1653969
This commit is contained in:
parent
bab8516a85
commit
c6e6939e89
@ -151,7 +151,11 @@ def iptables_dump():
|
||||
def _netns_list():
|
||||
process = subprocess.Popen(['ip', 'netns'], stdout=subprocess.PIPE)
|
||||
stdout, _ = process.communicate()
|
||||
return stdout.split()
|
||||
# NOTE(jlvillal): Sometimes 'ip netns list' can return output like:
|
||||
# qrouter-0805fd7d-c493-4fa6-82ca-1c6c9b23cd9e (id: 1)
|
||||
# qdhcp-bb2cc6ae-2ae8-474f-adda-a94059b872b5 (id: 0)
|
||||
output = [x.split()[0] for x in stdout.splitlines()]
|
||||
return output
|
||||
|
||||
|
||||
def network_dump():
|
||||
|
Loading…
Reference in New Issue
Block a user