bug-fix: 'bytes' type in python3 cause command fail
'str' type in python2 is 'bytes' type in python3,
when use python3, we will get a prefix 'b':
sudo ip netns exec b'qrouter-39cc2b45-a27c-49c5-94a6-26443a49ac63' ip
neigh
--------------------------------------------------------------------------
*** Failed to run 'sudo ip netns exec
b'qrouter-39cc2b45-a27c-49c5-94a6-26443a49ac63' ip neigh': Command 'sudo
ip netns exec b'qrouter-39cc2b45-a27c-49c5-94a6-26443a49ac63' ip neigh'
returned non-zero exit status 1.
The message above is raised by running tools/worlddump.py with python3.
Change-Id: Ic254af86fa27729839f00c0ad4a5bbbc9e545a09
diff --git a/tools/worlddump.py b/tools/worlddump.py
old mode 100644
new mode 100755
index 1e6e176..b21ed0c
--- a/tools/worlddump.py
+++ b/tools/worlddump.py
@@ -174,7 +174,7 @@
_dump_cmd("ip %s" % cmd)
for netns_ in _netns_list():
for cmd in ip_cmds:
- args = {'netns': netns_, 'cmd': cmd}
+ args = {'netns': bytes.decode(netns_), 'cmd': cmd}
_dump_cmd('sudo ip netns exec %(netns)s ip %(cmd)s' % args)
@@ -195,7 +195,7 @@
_dump_cmd("sudo ovs-vsctl show")
for ofctl_cmd in ofctl_cmds:
for bridge in bridges:
- args = {'vers': vers, 'cmd': ofctl_cmd, 'bridge': bridge}
+ args = {'vers': vers, 'cmd': ofctl_cmd, 'bridge': bytes.decode(bridge)}
_dump_cmd("sudo ovs-ofctl --protocols=%(vers)s %(cmd)s %(bridge)s" % args)