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

References: bsc#1042709

Index: virt-manager-1.5.0/virtinst/urlfetcher.py
===================================================================
--- virt-manager-1.5.0.orig/virtinst/urlfetcher.py
+++ virt-manager-1.5.0/virtinst/urlfetcher.py
@@ -470,9 +470,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
openSUSE Build Service is sponsored by