From 05a0d8d1dc998b5064e936a38cd67df43db6cb8b Mon Sep 17 00:00:00 2001 From: Mike Bonnet Date: Tue, 10 Nov 2015 13:29:27 -0500 Subject: [PATCH] cleanup the build directory when re-running a failed build --- hub/kojihub.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hub/kojihub.py b/hub/kojihub.py index 4dc2bcf..d9f9d71 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -4404,6 +4404,9 @@ def new_build(data): owner=%(owner)s,completion_time=%(completion_time)s,create_event=get_event() WHERE id = %(id)i""" _dml(update, data) + builddir = koji.pathinfo.build(data) + if os.path.exists(builddir): + shutil.rmtree(builddir) koji.plugin.run_callbacks('postBuildStateChange', attribute='state', old=state, new=data['state'], info=data) return id raise koji.GenericError, "Build already exists (id=%d, state=%s): %r" \ -- 1.8.2.1