]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/dashboard/__init__.py
import 15.2.4
[ceph.git] / ceph / src / pybind / mgr / dashboard / __init__.py
CommitLineData
11fdf7f2
TL
1# -*- coding: utf-8 -*-
2# pylint: disable=wrong-import-position,global-statement,protected-access
3"""
4ceph dashboard module
5"""
6from __future__ import absolute_import
7c673cae 7
11fdf7f2
TL
8import os
9
10
11if 'UNITTEST' not in os.environ:
11fdf7f2
TL
12 class _ModuleProxy(object):
13 def __init__(self):
14 self._mgr = None
15
16 def init(self, module_inst):
11fdf7f2 17 self._mgr = module_inst
11fdf7f2
TL
18
19 def __getattr__(self, item):
20 if self._mgr is None:
21 raise AttributeError("global manager module instance not initialized")
22 return getattr(self._mgr, item)
23
24 mgr = _ModuleProxy()
11fdf7f2 25
11fdf7f2
TL
26else:
27 import logging
28 logging.basicConfig(level=logging.DEBUG)
11fdf7f2
TL
29 logging.root.handlers[0].setLevel(logging.DEBUG)
30 os.environ['PATH'] = '{}:{}'.format(os.path.abspath('../../../../build/bin'),
31 os.environ['PATH'])
32
e306af50 33 from tests import mock, mock_ceph_modules # type: ignore
11fdf7f2
TL
34
35 mgr = mock.Mock()
eafe8130 36 mgr.get_frontend_path.side_effect = lambda: os.path.abspath("./frontend/dist")
e306af50
TL
37
38 mock_ceph_modules()
39
40# DO NOT REMOVE: required for ceph-mgr to load a module
41from .module import Module, StandbyModule # noqa: F401