class FileHandler(logging.FileHandler):
def __init__(self, module_inst):
- path = module_inst._ceph_get_option("log_file")
+ path = module_inst.get_ceph_option("log_file")
idx = path.rfind(".log")
if idx != -1:
self.path = "{}.{}.log".format(path[:idx], module_inst.module_name)
super(MgrStandbyModule, self).__init__(capsule)
self.module_name = module_name
- mgr_level = self._ceph_get_option("debug_mgr")
+ mgr_level = self.get_ceph_option("debug_mgr")
log_level = self.get_module_option("log_level")
self._configure_logging(mgr_level, log_level, False)
self.module_name = module_name
super(MgrModule, self).__init__(py_modules_ptr, this_ptr)
- mgr_level = self._ceph_get_option("debug_mgr")
+ mgr_level = self.get_ceph_option("debug_mgr")
log_level = self.get_module_option("log_level")
self._configure_logging(mgr_level, log_level,
self.get_module_option("log_to_file", False))
def _config_notify(self):
# check logging options for changes
- mgr_level = self._ceph_get_option("debug_mgr")
+ mgr_level = self.get_ceph_option("debug_mgr")
module_level = self.get_module_option("log_level")
log_to_file = self.get_module_option("log_to_file", False)
if k.startswith(prefix)
}
+def get_ceph_option(_, key):
+ return __file__
@pytest.yield_fixture()
def ssh_module():
- with mock.patch("ssh.module.SSHOrchestrator.get_ceph_option", lambda _, key: __file__),\
+ with mock.patch("ssh.module.SSHOrchestrator.get_ceph_option", get_ceph_option),\
+ mock.patch("ssh.module.SSHOrchestrator._configure_logging", lambda *args: None),\
mock.patch("ssh.module.SSHOrchestrator.set_store", set_store),\
mock.patch("ssh.module.SSHOrchestrator.get_store", get_store),\
mock.patch("ssh.module.SSHOrchestrator.get_store_prefix", get_store_prefix):
+ SSHOrchestrator._register_commands('')
m = SSHOrchestrator.__new__ (SSHOrchestrator)
m._store = {
'ssh_config': '',