From e58bcc4a414eb4385fe3de668e1694f39c72b4f7 Mon Sep 17 00:00:00 2001 From: Ernesto Puerta Date: Thu, 10 Oct 2019 11:17:43 +0200 Subject: [PATCH] mgr/dashboard: add new interfaces to plugin 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 --- .../mgr/dashboard/plugins/interfaces.py | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/dashboard/plugins/interfaces.py b/src/pybind/mgr/dashboard/plugins/interfaces.py index 3ef41fd3312..ce449acfe01 100644 --- a/src/pybind/mgr/dashboard/plugins/interfaces.py +++ b/src/pybind/mgr/dashboard/plugins/interfaces.py @@ -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): -- 2.39.5