There may be case where enterprise distros decide to adopt the "unknown"
approach in osinfo-db and there we'll be able to see different versions
of "unknown" and in order to avoid those to be shown to the user, let's
just ignore them when matching the regex.

This approach seems less error prone then trying to do that in the regex
itself and that's the reason it's been taken.

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 ec9aa430..98104553 100644
--- a/virtinst/osdict.py
+++ b/virtinst/osdict.py
@@ -235,7 +235,7 @@ class _OSDB(object):
         """
         Return the latest distro name that matches the passed regex
         """
-        oses = [o.name for o in self.list_os() if re.match(regex, o.name)]
+        oses = [o.name for o in self.list_os() if re.match(regex, o.name) and 
not o.name.endswith("-unknown")]
         if not oses:
             return None
 
-- 
2.19.1

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

Reply via email to