aboutsummaryrefslogtreecommitdiff
path: root/rpkid/testbed.py
diff options
context:
space:
mode:
Diffstat (limited to 'rpkid/testbed.py')
-rw-r--r--rpkid/testbed.py26
1 files changed, 14 insertions, 12 deletions
diff --git a/rpkid/testbed.py b/rpkid/testbed.py
index 097260f3..b38dfff3 100644
--- a/rpkid/testbed.py
+++ b/rpkid/testbed.py
@@ -213,10 +213,6 @@ class main(object):
try:
- # The changes to make this code run event-driven almost
- # certainly break the original intent of this try/finally logic.
- # Will need clean up after I/O core change.
-
rpki.log.info("Starting rootd")
self.rootd_process = subprocess.Popen((prog_python, prog_rootd, "-c", rootd_name + ".conf"))
@@ -233,30 +229,33 @@ class main(object):
rpki.log.info("Sleeping %d seconds while daemons start up" % startup_delay)
time.sleep(startup_delay)
- def create_rpki_objects(iterator, a):
- a.create_rpki_objects(iterator)
+ # At this point we have to start doing network I/O, so set up
+ # the next step in the initialization sequence, then start the
+ # async I/O loop.
- rpki.async.iterator(self.db.engines, create_rpki_objects, self.created_rpki_objects)
+ rpki.async.iterator(self.db.engines, self.create_rpki_objects, self.created_rpki_objects)
rpki.async.event_loop()
# At this point we have gone into event-driven code.
- # See comments above about cleanup of this try/finally code
- rpki.log.info("All done")
+ rpki.log.info("Event loop exited normally")
+
+ except:
- # Clean up
+ rpki.log.inf9("Event loop exited with an exception")
+ raise
finally:
- rpki.log.info("Shutting down")
+ rpki.log.info("Cleaning up")
for a in self.db.engines:
a.kill_daemons()
for proc, name in ((self.rootd_process, "rootd"),
(self.pubd_process, "pubd"),
(self.rsyncd_process, "rsyncd")):
if proc is not None:
- rpki.log.info("Killing %s" % name)
+ rpki.log.info("Killing %s, pid %s" % (name, proc.pid))
try:
os.kill(proc.pid, signal.SIGTERM)
except OSError:
@@ -264,6 +263,9 @@ class main(object):
proc.wait()
+ def create_rpki_objects(self, iterator, a):
+ a.create_rpki_objects(iterator)
+
def created_rpki_objects(self):
# Setup keys and certs and write YAML files for leaves