Ensure there's always an http server object
It's possible for a test to complete before python gets around to
actually starting the webapp run thread. Make sure that the
object referenced in the stop method is always instantiated to
avoid "AttributeError: 'WebApp' object has no attribute 'server'"
errors.
Also, mark the webapp thread as daemon on general principle.
Change-Id: I9b4c0c20a98d5429c299748178e31baf8b6912d9
diff --git a/zuul/webapp.py b/zuul/webapp.py
index 193d1b6..6b04384 100644
--- a/zuul/webapp.py
+++ b/zuul/webapp.py
@@ -26,10 +26,11 @@
threading.Thread.__init__(self)
self.scheduler = scheduler
self.port = port
-
- def run(self):
+ self.daemon = True
self.server = httpserver.serve(self.app, host='0.0.0.0',
port=self.port, start_loop=False)
+
+ def run(self):
self.server.serve_forever()
def stop(self):