File virtinst-sap-detection.patch of Package virt-manager.18136

Index: virt-manager-2.2.1/virtinst/install/urldetect.py
===================================================================
--- virt-manager-2.2.1.orig/virtinst/install/urldetect.py
+++ virt-manager-2.2.1/virtinst/install/urldetect.py
@@ -267,9 +267,16 @@ class _SUSEContent(object):
         distro_version = distro_version.strip()
 
         if "Enterprise" in self.product_name or "SLES" in self.product_name:
-            sle_version = self.product_name.strip().rsplit(' ')[4]
+            if " SAP " in self.product_name:
+                sle_version = self.product_name.strip().rsplit(' ')[7]
+            else:
+                sle_version = self.product_name.strip().rsplit(' ')[4]
             if len(self.product_name.strip().rsplit(' ')) > 5:
-                sle_version = (sle_version + '.' +
+                if " SAP " in self.product_name:
+                    sle_version = (sle_version + '.' +
+                        self.product_name.strip().rsplit(' ')[8][2])
+                else:
+                    sle_version = (sle_version + '.' +
                         self.product_name.strip().rsplit(' ')[5][2])
             distro_version = sle_version
 
@@ -579,7 +586,7 @@ class _SuseDistro(_RHELDistro):
         if self._variant_prefix.startswith(("caasp")):
             return self._variant_prefix + distro_version
 
-        if int(version) < 10:
+        if isinstance(version, int) and int(version) < 10:
             return self._variant_prefix + "9"
 
         if str(self._variant_prefix).startswith(("sles", "sled", "oes")):
openSUSE Build Service is sponsored by