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
This commit is contained in:
David Shrewsbury 2017-04-27 12:57:01 -04:00
parent 6b949f8abb
commit feaa6ad51b
1 changed files with 3 additions and 1 deletions

View File

@ -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