Commit 6b5e5018 authored by Guido Trotter's avatar Guido Trotter
Browse files

Convert ganeti-masterd to @utils.SignalHandled

Signed-off-by: default avatarGuido Trotter <>
Reviewed-by: default avatarIustin Pop <>
parent 451575de
......@@ -108,14 +108,17 @@ class IOServer(SocketServer.UnixStreamServer):
self.request_workers.AddTask(self, request, client_address)
def serve_forever(self):
@utils.SignalHandled([signal.SIGINT, signal.SIGTERM])
def serve_forever(self, signal_handlers=None):
"""Handle one request at a time until told to quit."""
sighandler = utils.SignalHandler([signal.SIGINT, signal.SIGTERM])
while not sighandler.called:
assert isinstance(signal_handlers, dict) and \
len(signal_handlers) > 0, \
"Broken SignalHandled decorator"
# Since we use SignalHandled only once, the resulting dict will map all
# signals to the same handler. We'll just use the first one.
sighandler = signal_handlers.values()[0]
while not sighandler.called:
def server_cleanup(self):
"""Cleanup the server.
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