[virt-tools-list] [virt-manager PATCH 3/3] osdict: adapt	latest_regex() to ignore "-unknown" distros
    Fabiano Fidêncio 
    fidencio at redhat.com
       
    Thu Oct 18 11:43:51 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 9254b006..732adecb 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