File virtinst-fix-sle-distro-parsing.patch of Package virt-manager

References: bsc#1042709

Index: virt-manager-1.4.1/virtinst/urlfetcher.py
===================================================================
--- virt-manager-1.4.1.orig/virtinst/urlfetcher.py
+++ virt-manager-1.4.1/virtinst/urlfetcher.py
@@ -444,9 +444,20 @@ def _distroFromSUSEContent(fetcher, arch
             arch = "ppc64le"
 
     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]
+        d_list = d[1].strip().rsplit(' ')
+        d_len = len(d_list)
+        sle_version = 12
+        counter = 0
+        while counter < d_len:
+            item = d_list[counter].strip()
+            if item.isdigit():
+                sle_version = item
+                if counter+1 < d_len:
+                    item = d_list[counter+1].strip()
+                    if item[2].isdigit():
+                        sle_version = sle_version + '.' + item[2]
+                break
+            counter += 1
         return ['VERSION', sle_version]
 
     dclass = GenericDistro
@@ -1029,7 +1040,10 @@ class SuseDistro(Distro):
         distro_version = self.version_from_content[1].strip()
         version = distro_version.split('.', 1)[0].strip()
         self.os_variant = self.urldistro
-        version_int = int(version)
+        if version.isdigit():
+            version_int = int(version)
+        else:
+            version_int = 12
         if version_int >= 10:
             if self.os_variant.startswith(("sles", "sled")):
                 sp_version = None
openSUSE Build Service is sponsored by