From 2d9543ffc650443a13af5a5a2b5cd3d638c750e0 Mon Sep 17 00:00:00 2001 From: Yuming Zhu Date: Oct 21 2021 08:44:10 +0000 Subject: [hub] getBuildType: ensure id exists in buildinfo dict if there is no id, call `get_build` to fetch the build data (n-v-r inside will be used or the data is invalid) fixes: #3091 --- diff --git a/hub/kojihub.py b/hub/kojihub.py index dd8dbe2..8792c79 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -4248,7 +4248,7 @@ def get_build(buildInfo, strict=False): """Return information about a build. buildInfo may be either a int ID, a string NVR, or a map containing - 'name', 'version' and 'release. + 'name', 'version' and 'release'. A map will be returned containing the following keys*: id: build ID @@ -4695,7 +4695,7 @@ def get_build_type(buildInfo, strict=False): Returns a dictionary whose keys are type names and whose values are the type info corresponding to that type """ - if not isinstance(buildInfo, dict) or 'extra' not in buildInfo: + if not isinstance(buildInfo, dict) or 'extra' not in buildInfo or 'id' not in buildInfo: binfo = get_build(buildInfo, strict=strict) if not binfo: return None