Handle missing node during hold check

A node can get removed from underneath us when we iterate through
all of them. Handle that better.

Change-Id: I28eb479eba4d59ef15e53c99f2abb58fb669ad39
This commit is contained in:
David Shrewsbury 2018-10-16 09:31:47 -04:00
parent 330d40e4c1
commit 95784a6630
1 changed files with 6 additions and 1 deletions

View File

@ -283,7 +283,12 @@ class ZooKeeper(object):
count = 0
for nodeid in nodes:
node_path = '%s/%s' % (self.NODE_ROOT, nodeid)
node_data, node_stat = self.client.get(node_path)
try:
node_data, node_stat = self.client.get(node_path)
except kze.NoNodeError:
# Node got removed on us. Just ignore.
continue
if not node_data:
self.log.warning("Node ID %s has no data", nodeid)
continue