# HG changeset patch
# User "Cole Robinson <crobinso@redhat.com>"
# Date 1223310077 14400
# Node ID 2aba69a1a16ce2eff6f115614607fda8bb3cfaaa
# Parent ca48e58d85ec52bf9eda14c01611860b79c5ff8e
Fix --bridge option to not report collision with --network (Mark McLoughlin)
diff -r ca48e58d85ec -r 2aba69a1a16c virtinst/cli.py
--- a/virtinst/cli.py Fri Oct 03 14:23:37 2008 -0400
+++ b/virtinst/cli.py Mon Oct 06 12:21:17 2008 -0400
@@ -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