Skip to content

Commit

Permalink
builds_initiated_via_hook always passed as a list & doc string update
Browse files Browse the repository at this point in the history
  • Loading branch information
jaitjacob authored and FrostyX committed Oct 15, 2024
1 parent 159fa14 commit 05511d9
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand All @@ -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

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 05511d9

Please sign in to comment.