Module: check_mk
Branch: master
Commit: f4ba768a1a8092e8ef1c42646f9ec7cfe72c4da3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f4ba768a1a8092…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri May 18 08:48:43 2018 +0200
Moved configure_event_history call out of load_config, it doesn't belong there.
Change-Id: I4903b4008f1130bc61eb63bd609612f8eda636e7
---
cmk/ec/main.py | 15 ++++++++-------
tests/integration/cmk/ec/test_mkeventd_status.py | 6 +++++-
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/cmk/ec/main.py b/cmk/ec/main.py
index 56c4ad7..76713c9 100644
--- a/cmk/ec/main.py
+++ b/cmk/ec/main.py
@@ -3876,7 +3876,7 @@ def update_slave_status(slave_status, settings, config):
# | Loading of the configuration files |
# '----------------------------------------------------------------------'
-def load_configuration(settings, logger, lock_history, mongodb, slave_status):
+def load_configuration(settings, logger, slave_status):
config = cmk.ec.export.load_config(settings)
# If not set by command line, set the log level by configuration
@@ -3888,9 +3888,6 @@ def load_configuration(settings, logger, lock_history, mongodb,
slave_status):
logger.getChild("StatusServer").setLevel(levels["cmk.mkeventd.StatusServer"])
logger.getChild("lock").setLevel(levels["cmk.mkeventd.lock"])
- history = cmk.ec.history.History(settings, config, logger, lock_history, mongodb)
- cmk.ec.history.configure_event_history(history)
-
# Are we a replication slave? Parts of the configuration
# will be overridden by values from the master.
update_slave_status(slave_status, settings, config)
@@ -3911,7 +3908,9 @@ def load_configuration(settings, logger, lock_history, mongodb,
slave_status):
def reload_configuration(settings, logger, lock_configuration, lock_history, mongodb,
event_status, event_server, status_server, slave_status):
with lock_configuration:
- config = load_configuration(settings, logger, lock_history, mongodb,
slave_status)
+ config = load_configuration(settings, logger, slave_status)
+ history = cmk.ec.history.History(settings, config, logger, lock_history,
mongodb)
+ cmk.ec.history.configure_event_history(history)
event_server.reload_configuration(config)
event_status.reload_configuration(config)
@@ -3950,10 +3949,12 @@ def main():
logger.info("-" * 65)
logger.info("mkeventd version %s starting" % cmk.__version__)
+ slave_status = default_slave_status_master()
+ config = load_configuration(settings, logger, slave_status)
lock_history = ECLock(logger.getChild("lock.history"))
mongodb = cmk.ec.history.MongoDB()
- slave_status = default_slave_status_master()
- config = load_configuration(settings, logger, lock_history, mongodb,
slave_status)
+ history = cmk.ec.history.History(settings, config, logger, lock_history,
mongodb)
+ cmk.ec.history.configure_event_history(history)
pid_path = settings.paths.pid_file.value
if pid_path.exists():
diff --git a/tests/integration/cmk/ec/test_mkeventd_status.py
b/tests/integration/cmk/ec/test_mkeventd_status.py
index 3285de0..933c933 100644
--- a/tests/integration/cmk/ec/test_mkeventd_status.py
+++ b/tests/integration/cmk/ec/test_mkeventd_status.py
@@ -74,7 +74,11 @@ def mongodb():
@pytest.fixture(scope="function")
def config(settings, lock_lock_history, mongodb, slave_status):
- return cmk.ec.main.load_configuration(settings,
logging.getLogger("cmk.mkeventd"), lock_history, mongodb, slave_status)
+ conf = cmk.ec.main.load_configuration(settings,
logging.getLogger("cmk.mkeventd"), slave_status)
+ history = cmk.ec.history.History(settings, conf, logger, lock_history, mongodb)
+ cmk.ec.history.configure_event_history(history)
+ return conf
+
@pytest.fixture(scope="function")