Skip to content

Commit

Permalink
Don't set gating status twice when creating update (#4219)
Browse files Browse the repository at this point in the history
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 <awilliam@redhat.com>
  • Loading branch information
AdamWill authored and AdamSaleh committed Sep 9, 2021
1 parent 5be589c commit 923522c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bodhi/server/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 923522c

Please sign in to comment.