Commit 99bdf04b authored by Sigmund Augdal's avatar Sigmund Augdal

Fixed continuous running mode while monitoring etcd-changes

parent 3acadd65
......@@ -125,9 +125,12 @@ class Generator(object):
index = None
self.addresses_v4 = self.get_addresses("ipv4")
self.addresses_v6 = self.get_addresses("ipv6_public")
self.output_file = tempfile.TemporaryFile()
self.group_members_groups = {}
self.by_source_groups = {}
self.serial = 0
self.output_file = tempfile.TemporaryFile()
old_groups = subprocess.check_output(["ipset", "list", "-name"])
old_groups = old_groups.split("\n")
old_groups = [group for group in old_groups if group]
......@@ -170,13 +173,18 @@ class Generator(object):
return index
def main(self):
index = self.generate_all()
sys.exit(0)
index = next(self.etcd_client.list("/nova/iaas")).index
self.generate_all()
while True:
data = self.etcd_client.watch("/nova/iaas", index+1)
index = data.index
if not data.key.startswith("nova/iaas/instances") and not \
data.key.startswith("nova/iaas/security_group"):
continue
logging.debug("new config index %d", data.index)
time.sleep(1)
index = self.generate_all()
index = next(self.etcd_client.list("/nova/iaas")).index
self.generate_all()
def daemon_main(args):
......
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