From e8ddacd10e4a27dbe8ee0e9904b9c927de6c15d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Mon, 30 Aug 2021 08:40:05 +0200 Subject: [PATCH] Fix type detection for osbuild images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The image type value passed to the task doesn't match the type as it will be recorded by Koji. JIRA: RHELCMP-5727 Signed-off-by: Lubomír Sedlář --- pungi/phases/osbuild.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pungi/phases/osbuild.py b/pungi/phases/osbuild.py index 15fe1c76..89719050 100644 --- a/pungi/phases/osbuild.py +++ b/pungi/phases/osbuild.py @@ -155,7 +155,7 @@ class RunOSBuildThread(WorkerThread): # architecture, but we don't verify that. build_info = koji.koji_proxy.getBuild(build_id) for archive in koji.koji_proxy.listArchives(buildID=build_id): - if archive["type_name"] not in config["image_types"]: + if archive["type_name"] not in EXTENSIONS: # Ignore values that are not of required types. continue @@ -182,8 +182,11 @@ class RunOSBuildThread(WorkerThread): linker.link(src_file, image_dest, link_type=compose.conf["link_type"]) - suffix = archive["filename"].rsplit(".", 1)[-1] - if suffix not in EXTENSIONS[archive["type_name"]]: + for suffix in EXTENSIONS[archive["type_name"]]: + if archive["filename"].endswith(suffix): + break + else: + # No suffix matched. raise RuntimeError( "Failed to generate metadata. Format %s doesn't match type %s" % (suffix, archive["type_name"])