[virt-tools-list] [PATCH] virtinst: Fix detection of sle12sp1 media

Charles Arnold carnold at suse.com
Fri Jun 3 16:31:29 UTC 2016


The installer wrongly detects SLE-12-SP1 media as SLE-12-GA

Signed-off-by: Charles Arnold <carnold at suse.com>

diff --git a/virtinst/urlfetcher.py b/virtinst/urlfetcher.py
index e329902..e477ee0 100644
--- a/virtinst/urlfetcher.py
+++ b/virtinst/urlfetcher.py
@@ -404,6 +404,10 @@ def _distroFromSUSEContent(fetcher, arch, vmtype=None):
             distro_distro = line.rsplit(',', 1)
         elif line.startswith("VERSION "):
             distro_version = line.split(' ', 1)
+            if len(distro_version) > 1:
+                d_version = distro_version[1].split('-', 1)
+                if len(d_version) > 1:
+                    distro_version[1] = d_version[0]
         elif line.startswith("SUMMARY "):
             distro_summary = line.split(' ', 1)
         elif line.startswith("BASEARCHS "):
@@ -433,17 +437,23 @@ def _distroFromSUSEContent(fetcher, arch, vmtype=None):
         elif cbuf.find("s390x") != -1:
             arch = "s390x"
 
+    def _parse_sle_distribution(d):
+        sle_version = d[1].strip().rsplit(' ')[4]
+        if len(d[1].strip().rsplit(' ')) > 5:
+            sle_version = sle_version + '.' + d[1].strip().rsplit(' ')[5][2]
+        return ['VERSION', sle_version]
+
     dclass = GenericDistro
     if distribution:
         if re.match(".*SUSE Linux Enterprise Server*", distribution[1]) or \
             re.match(".*SUSE SLES*", distribution[1]):
             dclass = SLESDistro
             if distro_version is None:
-                distro_version = ['VERSION', distribution[1].strip().rsplit(' ')[4]]
+                distro_version = _parse_sle_distribution(distribution)
         elif re.match(".*SUSE Linux Enterprise Desktop*", distribution[1]):
             dclass = SLEDDistro
             if distro_version is None:
-                distro_version = ['VERSION', distribution[1].strip().rsplit(' ')[4]]
+                distro_version = _parse_sle_distribution(distribution)
         elif re.match(".*openSUSE.*", distribution[1]):
             dclass = OpensuseDistro
             if distro_version is None:






More information about the virt-tools-list mailing list