[virt-tools-list] [virt-manager PATCH v3 3/3] osdict: adapt latest_os_version() to ignore "-unknown" distros

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


As some enterprise distros adopted the "unknown" approach in osinfo-db,
and those usually support different versions at the same time, there may
be different "unknown" entries (like rhel-unknown, rhel-8-unknown,
rhel-7-unknown, and so on) for the very same distro.

This situation can easily happen when some ISO matches, for exmaple,
"rhel-unknown" and then the latest one selected would be
"rhel-8-unknown".

In order to avoid this situation from happening, let's just ignore the
"unknown" entries when calling latest_regex().

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

diff --git a/virtinst/osdict.py b/virtinst/osdict.py
index 201ea3a9..3210a29e 100644
--- a/virtinst/osdict.py
+++ b/virtinst/osdict.py
@@ -250,7 +250,7 @@ class _OSDB(object):
         return oses[0]
 
     def latest_os_version(self, osdistro):
-        version = r"\.[0-9]+" if osdistro[-1].isdigit() else "[0-9]+"
+        version = r"\.[0-9]+(?!-unknown$)" if osdistro[-1].isdigit() else "[0-9]+(?!-unknown$)"
         return self.latest_regex(osdistro + version)
 
 
-- 
2.19.1




More information about the virt-tools-list mailing list