Skip to content

Commit 8d4ae4f

Browse files
author
LuyaoZhong
committed
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
1 parent 60a2a89 commit 8d4ae4f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tools/worlddump.py

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def network_dump():
174174
_dump_cmd("ip %s" % cmd)
175175
for netns_ in _netns_list():
176176
for cmd in ip_cmds:
177-
args = {'netns': netns_, 'cmd': cmd}
177+
args = {'netns': bytes.decode(netns_), 'cmd': cmd}
178178
_dump_cmd('sudo ip netns exec %(netns)s ip %(cmd)s' % args)
179179

180180

@@ -195,7 +195,7 @@ def ovs_dump():
195195
_dump_cmd("sudo ovs-vsctl show")
196196
for ofctl_cmd in ofctl_cmds:
197197
for bridge in bridges:
198-
args = {'vers': vers, 'cmd': ofctl_cmd, 'bridge': bridge}
198+
args = {'vers': vers, 'cmd': ofctl_cmd, 'bridge': bytes.decode(bridge)}
199199
_dump_cmd("sudo ovs-ofctl --protocols=%(vers)s %(cmd)s %(bridge)s" % args)
200200

201201

0 commit comments

Comments
 (0)