From 08fc223276ed8ecb11e9031535f0274f3f488242 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Sat, 21 Mar 2020 13:02:36 +0100 Subject: [PATCH] pipeline: delay cleanup of build tree Delay the cleanup of the build tree of the build pipeline, and first check the result and only cleanup the tree when the build did not fail, because in that case both returned trees will be None and trying to cleanup them up will result in an exception. Therefore, also don't clean up `tree` in the error case. --- osbuild/pipeline.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osbuild/pipeline.py b/osbuild/pipeline.py index 5223ad4c..620c6f6e 100644 --- a/osbuild/pipeline.py +++ b/osbuild/pipeline.py @@ -232,16 +232,16 @@ class Pipeline: interactive, libdir, secrets) - # Cleanup the build tree used to build `tree` - # which is not needed anymore - t.cleanup() results["build"] = r if not r["success"]: - tree.cleanup() results["success"] = False return results, None, None + # Cleanup the build tree (`t`) which was used to + # build `tree`; it is now not needed anymore + t.cleanup() + build_tree = tree # Create a new tree. The base is our tree_id because if that