virt-manager/virtinst-fix-sle-distro-parsing.patch
2017-08-22 14:08:14 +00:00

43 lines
1.6 KiB
Diff

References: bsc#1042709
Index: virt-manager-1.4.2/virtinst/urlfetcher.py
===================================================================
--- virt-manager-1.4.2.orig/virtinst/urlfetcher.py
+++ virt-manager-1.4.2/virtinst/urlfetcher.py
@@ -446,9 +446,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
@@ -1036,7 +1047,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