[fedora-virt-maint] rpms/python-virtinst/F-11 virtinst-0.400.3-safe-os-detect.patch, NONE, 1.1 python-virtinst.spec, 1.73, 1.74

Cole Robinson crobinso at fedoraproject.org
Thu Oct 22 13:35:54 UTC 2009


Author: crobinso

Update of /cvs/pkgs/rpms/python-virtinst/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv6635

Modified Files:
	python-virtinst.spec 
Added Files:
	virtinst-0.400.3-safe-os-detect.patch 
Log Message:
Ensure unknown OS detection doesn't break the install


virtinst-0.400.3-safe-os-detect.patch:
 OSDistro.py |   28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

--- NEW FILE virtinst-0.400.3-safe-os-detect.patch ---
# HG changeset patch
# User Cole Robinson <crobinso at redhat.com>
# Date 1241726968 14400
# Node ID db997572bdc8a8fc4c567fbf165f853167dfa462
# Parent  9768e52d4d624f83853f7f23f85402c8a078eb6f
Make sure autodetected OS type/variant are in the osdict.

If not, log a message and set the values to None, rather than barf later
down the line.

diff -r 9768e52d4d62 -r db997572bdc8 virtinst/OSDistro.py
--- a/virtinst/OSDistro.py	Thu May 07 15:50:06 2009 -0400
+++ b/virtinst/OSDistro.py	Thu May 07 16:09:28 2009 -0400
@@ -28,6 +28,7 @@
 import ConfigParser
 
 import virtinst
+from virtinst.Guest import Guest
 from virtinst import _util
 from virtinst import _virtinst as _
 
@@ -118,8 +119,9 @@
         if iskernel is True:
             # FIXME: We should probably do this for both kernel and boot
             # disk?
+            os_type, os_variant = store.get_osdict_info()
             return (store.acquireKernel(guest, fetcher, progresscb),
-                    store.os_type, store.os_variant)
+                    os_type, os_variant)
         elif iskernel is False:
             return store.acquireBootDisk(fetcher, progresscb)
         else:
@@ -145,7 +147,7 @@
     import urlgrabber
     progress = urlgrabber.progress.BaseMeter()
     store = _acquireMedia(None, None, location, progress, arch, "/var/tmp")
-    return (store.os_type, store.os_variant)
+    return store.get_osdict_info()
 
 
 def distroFromTreeinfo(fetcher, progresscb, uri, arch, vmtype=None,
@@ -246,6 +248,28 @@
             raise RuntimeError(_("Could not find boot.iso in %s tree." % \
                                self.name))
 
+    def get_osdict_info(self):
+        """
+        Return (distro, variant) tuple, checking to make sure they are valid
+        osdict entries
+        """
+        if not self.os_type:
+            return (None, None)
+
+        if self.os_type not in Guest.list_os_types():
+            logging.debug("%s set os_type to %s, which is not in osdict." %
+                          (self, self.os_type))
+            return (None, None)
+
+        if (self.os_variant and
+            self.os_variant not in Guest.list_os_variants(self.os_type)):
+            logging.debug("%s set os_variant to %s, which is not in osdict"
+                          " for distro %s." %
+                          (self, self.os_variant, self.os_type))
+            return (self.os_type, None)
+
+        return (self.os_type, self.os_variant)
+
     def _hasTreeinfo(self, fetcher, progresscb):
         # all Red Hat based distros should have .treeinfo, perhaps others
         # will in time


Index: python-virtinst.spec
===================================================================
RCS file: /cvs/pkgs/rpms/python-virtinst/F-11/python-virtinst.spec,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -p -r1.73 -r1.74
--- python-virtinst.spec	6 Oct 2009 15:10:00 -0000	1.73
+++ python-virtinst.spec	22 Oct 2009 13:35:54 -0000	1.74
@@ -17,7 +17,7 @@
 Summary: Python modules and utilities for installing virtual machines
 Name: python-%{appname}
 Version: 0.400.3
-Release: 11%{_extra_release}
+Release: 12%{_extra_release}
 Source0: http://virt-manager.org/download/sources/%{appname}/%{appname}-%{version}.tar.gz
 Patch1: %{appname}-%{version}-fix-virtimage-scratch.patch
 Patch2: %{appname}-%{version}-hostdev-libvirt-calls.patch
@@ -49,6 +49,8 @@ Patch15: %{appname}-%{version}-sasl-auth
 Patch16: %{appname}-%{version}-windows-acpi.patch
 # Add CLI tests
 Patch17: %{appname}-%{version}-add-cli-test.patch
+# Ensure unknown OS detection doesn't break the install
+Patch18: %{appname}-%{version}-safe-os-detect.patch
 
 License: GPLv2+
 Group: Development/Libraries
@@ -93,6 +95,7 @@ and install new VMs) and virt-clone (clo
 %patch15 -p1
 %patch16 -p1
 %patch17 -p1
+%patch18 -p1
 
 %build
 python setup.py build
@@ -128,6 +131,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_bindir}/virt-convert
 
 %changelog
+* Thu Oct 22 2009 Cole Robinson <crobinso at redhat.com> - 0.400.3-12.fc11
+- Ensure unknown OS detection doesn't break the install
+
 * Mon Oct 05 2009 Cole Robinson <crobinso at redhat.com> - 0.400.3-11.fc11
 - Allow SASL auth (bz 484099)
 - Use ACPI for windows on KVM (bz 479977)




More information about the Fedora-virt-maint mailing list