From 05511d91d5ab258c55e12245f3a57b9238425934 Mon Sep 17 00:00:00 2001 From: Jait Jacob Date: Tue, 15 Oct 2024 00:58:01 +0530 Subject: [PATCH] builds_initiated_via_hook always passed as a list & doc string update --- .../coprs/views/webhooks_ns/webhooks_general.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/frontend/coprs_frontend/coprs/views/webhooks_ns/webhooks_general.py b/frontend/coprs_frontend/coprs/views/webhooks_ns/webhooks_general.py index 558727005..1cb64688f 100644 --- a/frontend/coprs_frontend/coprs/views/webhooks_ns/webhooks_general.py +++ b/frontend/coprs_frontend/coprs/views/webhooks_ns/webhooks_general.py @@ -85,8 +85,8 @@ def decorated_function(copr, **kwargs): def add_webhook_history_record(webhook_uuid, user_agent=None, builds_initiated_via_hook=None): """ - This methods adds info of an intercepted webhook to webhook_history db - along with the initiated build number(s). + This method adds info of an intercepted webhook to webhook_history db + and updates the Build table with the corresponding webhook_history ID. """ if builds_initiated_via_hook is None: log.debug("No build initiated. Webhook not logged to db.") @@ -97,9 +97,6 @@ def add_webhook_history_record(webhook_uuid, user_agent=None, user_agent=user_agent) db.session.add(webhook_record) - if not isinstance(builds_initiated_via_hook, list): - builds_initiated_via_hook = [builds_initiated_via_hook] - for build in builds_initiated_via_hook: build.webhook_history = webhook_record @@ -350,7 +347,7 @@ def custom_build_submit(copr, package, copr_dir=None): return "BUILD_REQUEST_ERROR\n", 500 user_agent = flask.request.headers.get('User-Agent') - add_webhook_history_record(None, user_agent, build) + add_webhook_history_record(None, user_agent, [build]) # Return the build ID, so (e.g.) the CI process (e.g. Travis job) knows # what build results to wait for.