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:
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')]
# 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_{}'
mgr = mgr
-class CanLog(Mixin):
- import logging
- log = logging.getLogger()
-
-
class CanCherrypy(Mixin):
import cherrypy
request = cherrypy.request
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.
"""
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)