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 <[email protected]>
---
 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

_______________________________________________
virt-tools-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-tools-list

Reply via email to