From 745f86c94c5f9555712634444c316b45ce948dc9 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Tue, 17 Oct 2023 11:49:40 +0200 Subject: [PATCH] tools/osbuild-mpp: Really fix empty ostree commit object in deploy stage The fix in 980ca03685e674ef6cda7b5383aede84dff44560 ensured that no empty commit object was changed, but it still created an (empty) input object, which causes failures, like: https://gitlab.com/CentOS/automotive/sample-images/-/merge_requests/388 We need to move the check before the line that adds the empty default input object. --- tools/osbuild-mpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/osbuild-mpp b/tools/osbuild-mpp index 5ed866d7..804c370d 100755 --- a/tools/osbuild-mpp +++ b/tools/osbuild-mpp @@ -1621,8 +1621,6 @@ class ManifestFileV2(ManifestFile): ["org.osbuild.ostree.pull", "org.osbuild.ostree.deploy"]: return - inputs = element_enter(stage, "inputs", {}) - # The ostree.deploy stage accepts both containers or # ostree commits as input. If this is an ostree.deploy # stage and there are no commits in the inputs then let's @@ -1630,9 +1628,11 @@ class ManifestFileV2(ManifestFile): # from being created when a container image is used as # an input to ostree.deploy and not an ostree commit. if stage.get("type", "") == "org.osbuild.ostree.deploy": - if "commits" not in inputs: + if "commits" not in stage.get("inputs", {}): return + inputs = element_enter(stage, "inputs", {}) + inputs_commits = element_enter(inputs, "commits", {}) if inputs_commits.get("type", "") != "org.osbuild.ostree":