From: Ricardo Dias Date: Mon, 4 Nov 2019 09:33:44 +0000 (+0000) Subject: mgr/dashboard: plugins: deleted `CanLog` interface X-Git-Tag: v15.1.0~694^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=875c3e0f15cc5fe1b3c84dc1d24b3f647190b771;p=ceph.git mgr/dashboard: plugins: deleted `CanLog` interface Signed-off-by: Ricardo Dias --- diff --git a/src/pybind/mgr/dashboard/HACKING.rst b/src/pybind/mgr/dashboard/HACKING.rst index b273f0daee3..da41e8c17b4 100644 --- a/src/pybind/mgr/dashboard/HACKING.rst +++ b/src/pybind/mgr/dashboard/HACKING.rst @@ -1942,7 +1942,6 @@ In order to create a new plugin, the following steps are required: The available Mixins (helpers) are: - ``CanMgr``: provides the plug-in with access to the ``mgr`` instance under ``self.mgr``. -- ``CanLog``: provides the plug-in with access to the Ceph Dashboard logger under ``self.log``. The available Interfaces are: @@ -1985,9 +1984,8 @@ A sample plugin implementation would look like this: import cherrypy @PM.add_plugin - class Mute(I.CanMgr, I.CanLog, I.Setupable, I.HasOptions, - I.HasCommands, I.FilterRequest.BeforeHandler, - I.HasControllers): + class Mute(I.CanMgr, I.Setupable, I.HasOptions, I.HasCommands, + I.FilterRequest.BeforeHandler, I.HasControllers): @PM.add_hook def get_options(self): return [Option('mute', default=False, type='bool')] diff --git a/src/pybind/mgr/dashboard/plugins/feature_toggles.py b/src/pybind/mgr/dashboard/plugins/feature_toggles.py index c9124195abd..6428687d487 100644 --- a/src/pybind/mgr/dashboard/plugins/feature_toggles.py +++ b/src/pybind/mgr/dashboard/plugins/feature_toggles.py @@ -46,7 +46,7 @@ class Actions(Enum): # pylint: disable=too-many-ancestors @PM.add_plugin -class FeatureToggles(I.CanMgr, I.CanLog, I.Setupable, I.HasOptions, +class FeatureToggles(I.CanMgr, I.Setupable, I.HasOptions, I.HasCommands, I.FilterRequest.BeforeHandler, I.HasControllers): OPTION_FMT = 'FEATURE_TOGGLE_{}' diff --git a/src/pybind/mgr/dashboard/plugins/interfaces.py b/src/pybind/mgr/dashboard/plugins/interfaces.py index a08c3aac1c3..fdf6fdc58d6 100644 --- a/src/pybind/mgr/dashboard/plugins/interfaces.py +++ b/src/pybind/mgr/dashboard/plugins/interfaces.py @@ -9,11 +9,6 @@ class CanMgr(Mixin): mgr = mgr -class CanLog(Mixin): - import logging - log = logging.getLogger() - - class CanCherrypy(Mixin): import cherrypy request = cherrypy.request @@ -35,7 +30,7 @@ class Setupable(Interface): def setup(self): """ Placeholder for plugin setup, right after server start. - CanMgr.mgr and CanLog.log are initialized by then. + CanMgr.mgr is initialized by then. """ diff --git a/src/pybind/mgr/dashboard/plugins/plugin.py b/src/pybind/mgr/dashboard/plugins/plugin.py index 0f52aefbf95..17225810f0f 100644 --- a/src/pybind/mgr/dashboard/plugins/plugin.py +++ b/src/pybind/mgr/dashboard/plugins/plugin.py @@ -4,10 +4,10 @@ from . import PLUGIN_MANAGER as PM from . import interfaces as I # noqa: E741,N812 -class SimplePlugin(I.CanMgr, I.CanLog, I.HasOptions, I.HasCommands): +class SimplePlugin(I.CanMgr, I.HasOptions, I.HasCommands): """ Helper class that provides simplified creation of plugins: - - Default Mixins/Interfaces: CanMgr, CanLog, HasOptions & HasCommands + - Default Mixins/Interfaces: CanMgr, HasOptions & HasCommands - Options are defined by OPTIONS class variable, instead from get_options hook - Commands are created with by COMMANDS list of Commands() and handlers (less compact than CLICommand, but allows using method instances)