[PATCH] [Kimchi] Fix ovs commands output handling

I've noticed this problem in Kimchi's error output: rc: 1 error: ovs-vsctl: no bridge named \nbr0 returned from cmd: /bin/ovs-vsctl --oneline list-ports \nbr0 Error listing OVS bridge ports for \nbr0 This patch fixes that by: - removing --oneline usage from ovs command; - using list comprehensions to split() each string in the list. Signed-off-by: Lucio Correia <luciojhc@linux.vnet.ibm.com> --- netinfo.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/netinfo.py b/netinfo.py index ff91489..c00f603 100644 --- a/netinfo.py +++ b/netinfo.py @@ -94,12 +94,12 @@ def ovs_bridges(): if ovs_cmd is None: return [] - out, error, rc = run_command([ovs_cmd, '--oneline', 'list-br']) + out, error, rc = run_command([ovs_cmd, 'list-br']) if rc != 0: wok_log.info("Error listing OVS bridges") return [] - return list(set(out.split('\n')) - set([''])) + return [x.strip() for x in out.rstrip('\n').split('\n') if x.strip()] def is_ovs_bridge(iface): @@ -113,12 +113,12 @@ def ovs_bridge_ports(ovsbr): if ovs_cmd is None: return [] - out, error, rc = run_command([ovs_cmd, '--oneline', 'list-ports', ovsbr]) + out, error, rc = run_command([ovs_cmd, 'list-ports', ovsbr]) if rc != 0: wok_log.info("Error listing OVS bridge ports for %s" % str(ovsbr)) return [] - return list(set(out.split('\n')) - set([''])) + return [x.strip() for x in out.rstrip('\n').split('\n') if x.strip()] def all_interfaces(): -- 1.9.1

Applied. Thanks. Regards, Aline Manera
participants (2)
-
Aline Manera
-
Lucio Correia