diff options
author | Fabiano FidĂȘncio <fidencio@redhat.com> | 2019-07-16 17:14:32 +0200 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2019-07-16 16:54:30 -0400 |
commit | 7148727a05e3b3681f4067e951c0f7865fc00f8a (patch) | |
tree | 2febd393d2701145fcc8402677b7f14cd4228b98 | |
parent | 4d3b756e7038b254f6a2af14d29906cf67a9bb3d (diff) | |
download | virt-manager-7148727a05e3b3681f4067e951c0f7865fc00f8a.tar.gz |
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>
-rw-r--r-- | virtinst/osdict.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/virtinst/osdict.py b/virtinst/osdict.py index 3b71ac31..f09bcc29 100644 --- a/virtinst/osdict.py +++ b/virtinst/osdict.py @@ -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): """ |