[virt-tools-list] [virt-manager PATCH v3 2/3] osdict: adapt latest_regex() to openSUSE's versioning

Fabiano Fidêncio fidencio at redhat.com
Fri Nov 23 15:07:26 UTC 2018


Due to OpenSUSE's decision of versioning their OS as 11.x, 12.x, 42.x,
15.x, we have to add a specific check in latest_regex() in order to make
sure we skip the 42.x series in the sorted list of OSes when returning
the OS name to the user.

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 virtinst/osdict.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/virtinst/osdict.py b/virtinst/osdict.py
index 31f1d5c0..201ea3a9 100644
--- a/virtinst/osdict.py
+++ b/virtinst/osdict.py
@@ -238,6 +238,15 @@ class _OSDB(object):
         oses = [o.name for o in self.list_os() if re.match(regex, o.name)]
         if not oses:
             return None
+
+        # OpenSUSE's decision of having their versioning as 11.x, 12.x, 42.x,
+        # 15.x forces us to have this specific check for then.
+        # Knowing that 42 series was composed of 42.[1-3] and that the series
+        # will not have any more release, we can safely return the 4th element
+        # of the oses.
+        if regex.startswith("opensuse"):
+            return oses[3]
+
         return oses[0]
 
     def latest_os_version(self, osdistro):
-- 
2.19.1




More information about the virt-tools-list mailing list