From 923522cdc71d3a58a6a1d003df98aa8170accd70 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Tue, 18 May 2021 15:07:06 -0700 Subject: [PATCH] Don't set gating status twice when creating update (#4219) On the normal path of creating an update - where it is created and immediately submitted to updates-testing - we're setting the gating status twice. We call `set_request`, which calls `update_test_gating_status()` if the request is updates-testing and gating is required, and then almost immediately afterwards, we straight up set the status to 'waiting'. That doesn't make much sense. This changes things so that the `new()` method doesn't hard set the status to 'waiting' if it's calling `set_request` and the request is to updates-testing, as is usually the case. Signed-off-by: Adam Williamson --- bodhi/server/models.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bodhi/server/models.py b/bodhi/server/models.py index 80c6c6e33a..2775b23e59 100644 --- a/bodhi/server/models.py +++ b/bodhi/server/models.py @@ -2371,12 +2371,17 @@ def new(cls, request, data): log.debug(f"Triggering db commit for new update {up.alias}.") db.commit() + # track whether to set gating status shortly... + setgs = config.get('test_gating.required') # The request to testing for side-tag updates is set within the signed consumer if not data.get("from_tag"): log.debug(f"Setting request for new update {up.alias}.") up.set_request(db, req, request.user.name) + if req == UpdateRequest.testing: + # set_request will update gating status if necessary + setgs = False - if config.get('test_gating.required'): + if setgs: log.debug( 'Test gating required is enforced, marking the update as waiting on test gating') up.test_gating_status = TestGatingStatus.waiting