[PATCH] Fix virt-install iso path validation (BZ 249424)

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

 



This patch builds a VirtualDisk object using the cdrom path passed to
virt-install to reuse the already present validation. It also touches up
some of the error messages the VirtualDisk throws to make them more
general specific. This solves bz 249424.

- Cole

-- 
Cole Robinson
crobinso@xxxxxxxxxx
diff -r 531b73491ac2 virt-install
--- a/virt-install	Wed Oct 10 14:24:48 2007 -0400
+++ b/virt-install	Wed Oct 17 16:50:23 2007 -0400
@@ -160,11 +160,18 @@ def get_fullvirt_cdrom(cdpath, location,
     while 1:
         cdpath = cli.prompt_for_input(_("What is the virtual CD image, CD device or install location?"), cdpath)
         try:
+            cddisk = virtinst.VirtualDisk(path=cdpath, 
+                                          transient=True,
+                                          device=virtinst.VirtualDisk.DEVICE_CDROM,
+                                          readOnly=True)
             guest.cdrom = cdpath
             break
         except ValueError, e:
             print _("ERROR: "), e
             cdpath = None
+
+    # Clear disk as we only used it for validation
+    cddisk = None
 
 ### Option parsing
 def check_before_store(option, opt_str, value, parser):
diff -r 531b73491ac2 virtinst/Guest.py
--- a/virtinst/Guest.py	Wed Oct 10 14:24:48 2007 -0400
+++ b/virtinst/Guest.py	Wed Oct 17 16:50:23 2007 -0400
@@ -50,11 +50,11 @@ class VirtualDisk:
        
         if self.path is not None:
             if __builtin__.type(self.path) is not __builtin__.type("string"):
-                raise ValueError, _("The disk path must be a string or None.")
+                raise ValueError, _("The %s path must be a string or None.") % device
             self.path = os.path.abspath(self.path)
 
             if self.path != None and os.path.isdir(self.path):
-                raise ValueError, _("The disk path must be a file or a device, not a directory")
+                raise ValueError, _("The %s path must be a file or a device, not a directory") % device
 
             if not os.path.exists(os.path.dirname(self.path)):
                 raise ValueError, _("The specified path's root directory must exist.")
_______________________________________________
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