from .controllers.auth import Auth
from .tools import load_controllers, json_error_page, SessionExpireAtBrowserCloseTool, \
NotificationQueue
+from .services import Service
from . import logger
self._url_prefix = ''
def configure_cherrypy(self):
+ Service.mgr = self # injects module instance into Service class
+
server_addr = self.get_localized_config('server_addr', '::')
server_port = self.get_localized_config('server_port', '8080')
if server_addr is None:
--- /dev/null
+# -*- coding: utf-8 -*-
+from __future__ import absolute_import
+
+from six import add_metaclass
+
+
+class ServiceMeta(type):
+ @property
+ def mgr(cls):
+ """
+ :return: Returns the MgrModule instance of this Ceph dashboard module.
+ """
+ return cls._mgr_module
+
+ @mgr.setter
+ def mgr(cls, value):
+ """
+ :param value: The MgrModule instance of the Ceph dashboard module.
+ """
+ cls._mgr_module = value
+
+
+@add_metaclass(ServiceMeta)
+class Service(object):
+ """
+ Base class for all services.
+ """
+ _mgr_module = None
+
+ @property
+ def mgr(self):
+ """
+ :return: Returns the MgrModule instance of this Ceph module.
+ """
+ return self._mgr_module
LD_LIBRARY_PATH = {toxinidir}/../../../../build/lib
deps=-r{toxinidir}/requirements.txt
commands=
- pylint --rcfile=.pylintrc --jobs=5 . module.py tools.py controllers tests
+ pylint --rcfile=.pylintrc --jobs=5 . module.py tools.py controllers tests services
pycodestyle --max-line-length=100 --exclude=python2.7,.tox,venv,frontend --ignore=E402,E121,E123,E126,E226,E24,E704,W503 .