From feaa6ad51bffae978db57cd11c6085bd3d1b4fe3 Mon Sep 17 00:00:00 2001 From: David Shrewsbury Date: Thu, 27 Apr 2017 12:57:01 -0400 Subject: [PATCH] Protect against no matches for an upload It's possible that one of the children for an upload znode has been deleted by the time we request that child's znode data. Protect against that by adding a check for None returned from getImageUpload(). Change-Id: Ifd4e26baf480420d649e7ae85b43a57bf5338f96 --- nodepool/zk.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nodepool/zk.py b/nodepool/zk.py index a72dd7cb9..35886d960 100644 --- a/nodepool/zk.py +++ b/nodepool/zk.py @@ -1037,9 +1037,11 @@ class ZooKeeper(object): if upload == 'lock': continue data = self.getImageUpload(image, build_number, provider, upload) + if not data: + continue if states is None: matches.append(data) - elif data and data.state in states: + elif data.state in states: matches.append(data) return matches