From 2d959e4d435cf86764b5ebda250f82ebf442775c Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Mon, 23 Mar 2020 10:14:51 +0100 Subject: [PATCH] pipeline: ensure the build tree is always built If there is a build pipeline specified, always build it, even if there are no accompanying stages. If we short-circuit earlier and ignore the build pipeline section, errors in the build pipeline would not be caught at all. --- osbuild/pipeline.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/osbuild/pipeline.py b/osbuild/pipeline.py index 2465e5a2..7f9d94e5 100644 --- a/osbuild/pipeline.py +++ b/osbuild/pipeline.py @@ -217,11 +217,6 @@ class Pipeline: def build_stages(self, object_store, interactive, libdir, secrets): results = {"success": True} - if not self.stages: - build_tree = objectstore.HostTree(object_store) - tree = object_store.new() - return results, build_tree, tree - # We need a build tree for the stages below, which is either # another tree that needs to be built with the build pipeline # or the host file system if no build pipeline is specified @@ -249,6 +244,13 @@ class Pipeline: build_tree = tree + # If there are no stages, just return build tree we just + # obtained and a new, clean `tree` + if not self.stages: + tree = object_store.new() + return results, build_tree, tree + + # Create a new tree. The base is our tree_id because if that # is already in the store, we can short-circuit directly and # exit directly; `tree` is then used to read the tree behind