[PATCH] Fix virt-install --bridge

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>

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


_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux