[et-mgmt-tools] [PATCH] Fix virt-install --bridge
Mark McLoughlin
markmc at redhat.com
Mon Oct 6 14:12:28 UTC 2008
If you run virt-install with --bridge, you get:
ERROR Cannot mix both --bridge and --network arguments
because digest_networks() is comparing [] to None.
Reduce confusion by also normalizing the bridges argument to
a list and evaluating the lists as bools.
Signed-off-by: Mark McLoughlin <markmc at redhat.com>
diff -r ca48e58d85ec virtinst/cli.py
--- a/virtinst/cli.py Fri Oct 03 14:23:37 2008 -0400
+++ b/virtinst/cli.py Mon Oct 06 15:11:31 2008 +0100
@@ -277,24 +277,22 @@
guest.nics.append(n)
def digest_networks(conn, macs, bridges, networks, nics = 0):
- if type(bridges) != list and bridges != None:
- bridges = [ bridges ]
+ def listify(l):
+ if l is None:
+ return []
+ elif type(l) != list:
+ return [ l ]
+ else:
+ return l
- if macs is None:
- macs = []
- elif type(macs) != list:
- macs = [ macs ]
-
- if networks is None:
- networks = []
- elif type(networks) != list:
- networks = [ macs ]
+ macs = listify(macs)
+ bridges = listify(bridges)
+ networks = listify(networks)
- if bridges is not None and networks != None:
+ if bridges and networks:
fail(_("Cannot mix both --bridge and --network arguments"))
-
- if bridges != None:
+ if bridges:
networks = map(lambda b: "bridge:" + b, bridges)
# ensure we have less macs then networks. Auto fill in the remaining
More information about the et-mgmt-tools
mailing list