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

Fabiano Fidêncio fidencio at redhat.com
Fri Oct 19 16:54:54 UTC 2018


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 <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 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




More information about the virt-tools-list mailing list