Fix self fulfilling empty node requests

Emtpy node requests are intended to be fulfilled directly in zuul
without bugging zk. However we didn't check for this condition in
acceptNodes. This causes us to 'recreate' the missing empty node
request on zk, let nodepool fulfill it and accept this afterwards. Fix
this by short-circuiting acceptNodes if we have an empty and fulfilled
node request.

Change-Id: Ib953d366258e5724c85ae2a563e319422f4ada40
This commit is contained in:
Tobias Henkel 2018-01-24 10:45:01 +01:00
parent ad82bbf09f
commit 6205ed269f
No known key found for this signature in database
GPG Key ID: 03750DEC158E5FA2
1 changed files with 6 additions and 0 deletions

View File

@ -210,6 +210,12 @@ class Nodepool(object):
# The request was already deleted when it was canceled # The request was already deleted when it was canceled
return False return False
# If we didn't request nodes and the request is fulfilled then just
# return. We don't have to do anything in this case. Further don't even
# ask ZK for the request as empty requests are not put into ZK.
if not request.nodeset.nodes and request.fulfilled:
return True
# Make sure the request still exists. It's possible it could have # Make sure the request still exists. It's possible it could have
# disappeared if we lost the ZK session between when the fulfillment # disappeared if we lost the ZK session between when the fulfillment
# response was added to our queue, and when we actually get around to # response was added to our queue, and when we actually get around to