Commit f718cd87 authored by Sigmund Augdal's avatar Sigmund Augdal

Clean up etcd index usage in iptables_configurator as well

parent fa331311
......@@ -260,11 +260,7 @@ class Generator(object):
subprocess.call("ipset destroy {}".format(ipset), shell=True)
def get_initial_index(self):
index = 0
for node in self.etcd_client.read("/", recursive=True).children:
if node.modifiedIndex > index:
index = node.modifiedIndex
return index
return self.etcd_client.read("/nova/iaas", recursive=True).etcd_index
def main(self):
index = self.get_initial_index()
......@@ -276,15 +272,12 @@ class Generator(object):
while True:
data = self.etcd_client.read("/nova/iaas", recursive=True, wait=True,
waitIndex=index+1, timeout=0)
index = data.modifiedIndex # pylint: disable=E1103,E1101
index = data.etcd_index # pylint: disable=E1101
key = data.key # pylint: disable=E1101,E1103
if not key.startswith("/nova/iaas/instances") and not \
key.startswith("/nova/iaas/security_group"):
continue
time.sleep(1)
for node in self.etcd_client.read("/nova/iaas", recursive=True).children:
if node.modifiedIndex > index:
index = node.modifiedIndex
logging.debug("new config index %d", index)
self.generate_all()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment