mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
osdict: Use identify_tree()
Let's use identify_tree(), which is part of libosinfo v1.6.0 release, instead of using guess_os_from_tree(). The API has been implemented on libosinfo in order to be consistent with what was already done for medias. Reviewed-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
parent
4d3b756e70
commit
7148727a05
@ -260,10 +260,17 @@ class _OSDB(object):
|
||||
"location=%s : %s", location, str(e))
|
||||
return None
|
||||
|
||||
osobj, treeobj = self._os_loader.get_db().guess_os_from_tree(tree)
|
||||
if not osobj:
|
||||
return None # pragma: no cover
|
||||
return osobj.get_short_id(), _OsTree(treeobj)
|
||||
db = self._os_loader.get_db()
|
||||
if hasattr(db, "identify_tree"):
|
||||
# osinfo_db_identify_tree is part of libosinfo 1.6.0
|
||||
if not db.identify_tree(tree):
|
||||
return None # pragma: no cover
|
||||
return tree.get_os().get_short_id(), _OsTree(tree)
|
||||
else:
|
||||
osobj, treeobj = self._os_loader.get_db().guess_os_from_tree(tree)
|
||||
if not osobj:
|
||||
return None # pragma: no cover
|
||||
return osobj.get_short_id(), _OsTree(treeobj)
|
||||
|
||||
def list_os(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user