]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: add new interfaces to plugin
authorErnesto Puerta <epuertat@redhat.com>
Thu, 10 Oct 2019 09:17:43 +0000 (11:17 +0200)
committerErnesto Puerta <epuertat@redhat.com>
Thu, 10 Oct 2019 10:58:56 +0000 (12:58 +0200)
New plugin Mixins (`CanCherrypy`) and Interfaces (`Initializable`,
`ConfiguresCherryPy`) have been added to plugin interfaces.

Fixes: https://tracker.ceph.com/issues/41990
Signed-off-by: Ernesto Puerta <epuertat@redhat.com>
src/pybind/mgr/dashboard/plugins/interfaces.py

index 3ef41fd331272233c117b2d14bfcbcbbeff463e6..ce449acfe01f1b1fbb7f50d8902a3aa4a14726ef 100644 (file)
@@ -1,19 +1,34 @@
 # -*- coding: utf-8 -*-
 from __future__ import absolute_import
 
-from . import PLUGIN_MANAGER as PM, Interface  # pylint: disable=cyclic-import
+from . import PLUGIN_MANAGER as PM, Interface, Mixin  # pylint: disable=cyclic-import
 
 
-class CanMgr(Interface):
+class CanMgr(Mixin):
     from .. import mgr
     mgr = mgr
 
 
-class CanLog(Interface):
+class CanLog(Mixin):
     from .. import logger
     log = logger
 
 
+class CanCherrypy(Mixin):
+    import cherrypy
+    request = cherrypy.request
+    response = cherrypy.response
+
+
+@PM.add_interface
+class Initializable(Interface):
+    @PM.add_abcspec
+    def init(self):
+        """
+        Placeholder for module scope initialization
+        """
+
+
 @PM.add_interface
 class Setupable(Interface):
     @PM.add_abcspec
@@ -45,6 +60,13 @@ class HasControllers(Interface):
         pass
 
 
+@PM.add_interface
+class ConfiguresCherryPy(Interface):
+    @PM.add_abcspec
+    def configure_cherrypy(self, config):
+        pass
+
+
 class FilterRequest(object):
     @PM.add_interface
     class BeforeHandler(Interface):