Handle upgrade of autohold held nodes
An earlier change alters the autohold held node IDs from a list to a dict structure. If someone upgrades to this change, but has existing autoholds with the old format, we will break them. This change handles both cases. Change-Id: Ib6381e459a9694cae61ba3229d48ddfe8f55f392
This commit is contained in:
parent
81e3508938
commit
fdbabc863c
10
zuul/zk.py
10
zuul/zk.py
|
@ -592,7 +592,15 @@ class ZooKeeper(object):
|
|||
def getHeldNodeIDs(request):
|
||||
node_ids = []
|
||||
for data in request.nodes:
|
||||
node_ids += data['nodes']
|
||||
# TODO(Shrews): Remove type check at some point.
|
||||
# When autoholds were initially changed to be stored in ZK,
|
||||
# the node IDs were originally stored as a list of strings.
|
||||
# A later change embedded them within a dict. Handle both
|
||||
# cases here to deal with the upgrade.
|
||||
if isinstance(data, dict):
|
||||
node_ids += data['nodes']
|
||||
else:
|
||||
node_ids.append(data)
|
||||
return node_ids
|
||||
|
||||
failure = False
|
||||
|
|
Loading…
Reference in New Issue