From: John Spray Date: Mon, 4 Jul 2016 14:30:36 +0000 (+0100) Subject: pybind/mgr: implement shutdown() in rest.py X-Git-Tag: v11.0.1~60^2~44 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0bff7af03947ab3696465e413ae2b090c51f3bcc;p=ceph.git pybind/mgr: implement shutdown() in rest.py Signed-off-by: John Spray --- diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index d1e92a57a8b5..725af381ca05 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 44e6ed5c4e14..e5439b3a9155 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")