From 0bff7af03947ab3696465e413ae2b090c51f3bcc Mon Sep 17 00:00:00 2001 From: John Spray Date: Mon, 4 Jul 2016 15:30:36 +0100 Subject: [PATCH] pybind/mgr: implement shutdown() in rest.py Signed-off-by: John Spray --- src/pybind/mgr/mgr_module.py | 14 +++++++++++++- src/pybind/mgr/rest.py | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index d1e92a57a8b..725af381ca0 100644 --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@ -71,7 +71,19 @@ class MgrModule(object): """ Called by the ceph-mgr service to start any server that is provided by this Python plugin. The implementation - of this function should block until it receives a signal. + of this function should block until ``shutdown`` is called. + + You *must* implement ``shutdown`` if you implement ``serve`` + """ + pass + + def shutdown(self): + """ + Called by the ceph-mgr service to request that this + module drop out of its serve() function. You do not + need to implement this if you do not implement serve() + + :return: None """ pass diff --git a/src/pybind/mgr/rest.py b/src/pybind/mgr/rest.py index 44e6ed5c4e1..e5439b3a915 100644 --- a/src/pybind/mgr/rest.py +++ b/src/pybind/mgr/rest.py @@ -159,6 +159,9 @@ class Module(MgrModule): """ return [self._auth_cls()] + def shutdown(self): + cherrypy.engine.stop() + def serve(self): self.keys = self._load_keys() self.enable_auth = self.get_config_json("enable_auth") -- 2.39.5