]>
git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/__init__.py
1 # -*- coding: utf-8 -*-
2 # pylint: disable=wrong-import-position,global-statement,protected-access
6 from __future__
import absolute_import
12 if 'COVERAGE_ENABLED' in os
.environ
:
13 import coverage
# pylint: disable=import-error
14 __cov
= coverage
.Coverage(config_file
="{}/.coveragerc".format(os
.path
.dirname(__file__
)),
17 cherrypy
.engine
.subscribe('after_request', __cov
.save
)
18 cherrypy
.engine
.subscribe('stop', __cov
.stop
)
20 if 'UNITTEST' not in os
.environ
:
21 class _ModuleProxy(object):
25 def init(self
, module_inst
):
26 self
._mgr
= module_inst
28 def __getattr__(self
, item
):
30 raise AttributeError("global manager module instance not initialized")
31 return getattr(self
._mgr
, item
)
37 logging
.basicConfig(level
=logging
.DEBUG
)
38 logging
.root
.handlers
[0].setLevel(logging
.DEBUG
)
39 os
.environ
['PATH'] = '{}:{}'.format(os
.path
.abspath('../../../../build/bin'),
43 # Used to allow the running of a tox-based yml doc generator from the dashboard directory
44 if os
.path
.abspath(sys
.path
[0]) == os
.getcwd():
47 from tests
import mock
# type: ignore
50 mgr
.get_frontend_path
.side_effect
= lambda: os
.path
.abspath("./frontend/dist")
52 # DO NOT REMOVE: required for ceph-mgr to load a module
53 from .module
import Module
, StandbyModule
# noqa: F401