Module: check_mk
Branch: master
Commit: 89bb3bd57a41647550e9c2134aa883310210b497
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=89bb3bd57a4164…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue Jun 5 12:42:09 2018 +0200
Delay imports. Horrible...
Change-Id: Id88e829062573fd79362993b356fd2359dee0af7
---
cmk_base/cleanup.py | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/cmk_base/cleanup.py b/cmk_base/cleanup.py
index f33bd0b..ba1392e 100644
--- a/cmk_base/cleanup.py
+++ b/cmk_base/cleanup.py
@@ -26,17 +26,16 @@
"""Hacky module to avoid cyclic imports. This should
die..."""
-import cmk_base.checks
-import cmk_base.item_state
-import cmk_base.core
-import cmk_base.snmp
-
-
# Reset some global variable to their original value. This is needed in
# keepalive mode. We could in fact do some positive caching in keepalive mode,
# e.g. the counters of the hosts could be saved in memory.
def cleanup_globals():
+ # THIS IS HORRIBLE! We can't move the imports to the global scope because of
cycles...
+ import cmk_base.checks
cmk_base.checks.set_hostname("unknown")
+ import cmk_base.item_state
cmk_base.item_state.cleanup_item_states()
+ import cmk_base.core
cmk_base.core.cleanup_timeperiod_caches()
+ import cmk_base.snmp
cmk_base.snmp.cleanup_host_caches()