]>
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 DEFAULT_VERSION
= '1.0'
14 if 'COVERAGE_ENABLED' in os
.environ
:
15 import coverage
# pylint: disable=import-error
16 __cov
= coverage
.Coverage(config_file
="{}/.coveragerc".format(os
.path
.dirname(__file__
)),
19 cherrypy
.engine
.subscribe('after_request', __cov
.save
)
20 cherrypy
.engine
.subscribe('stop', __cov
.stop
)
22 if 'UNITTEST' not in os
.environ
:
23 class _ModuleProxy(object):
27 def init(self
, module_inst
):
28 self
._mgr
= module_inst
30 def __getattr__(self
, item
):
32 raise AttributeError("global manager module instance not initialized")
33 return getattr(self
._mgr
, item
)
39 logging
.basicConfig(level
=logging
.DEBUG
)
40 logging
.root
.handlers
[0].setLevel(logging
.DEBUG
)
41 os
.environ
['PATH'] = '{}:{}'.format(os
.path
.abspath('../../../../build/bin'),
45 # Used to allow the running of a tox-based yml doc generator from the dashboard directory
46 if os
.path
.abspath(sys
.path
[0]) == os
.getcwd():
49 from tests
import mock
# type: ignore
52 mgr
.get_frontend_path
.side_effect
= lambda: os
.path
.abspath("./frontend/dist")
54 # DO NOT REMOVE: required for ceph-mgr to load a module
55 from .module
import Module
, StandbyModule
# noqa: F401