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