]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
pybind/mgr: implement shutdown() in rest.py
authorJohn Spray <john.spray@redhat.com>
Mon, 4 Jul 2016 14:30:36 +0000 (15:30 +0100)
committerJohn Spray <john.spray@redhat.com>
Thu, 29 Sep 2016 16:26:58 +0000 (17:26 +0100)
Signed-off-by: John Spray <john.spray@redhat.com>
src/pybind/mgr/mgr_module.py
src/pybind/mgr/rest.py

index d1e92a57a8b5dbdd23e49334b0d0ef9d59b795c5..725af381ca054b6dc41ca64505ac78bc718b4766 100644 (file)
@@ -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
 
index 44e6ed5c4e14bc2090c501d964e840687eca09b3..e5439b3a91550c20203830bd8945b9b5fb277c8b 100644 (file)
@@ -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")