Module: check_mk
Branch: master
Commit: 6e40200d4de1c3d979ceb1dbd7b86ffd48fa516a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6e40200d4de1c3…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri May 18 12:04:19 2018 +0200
Centralized "derived config variables"
Change-Id: I4abcb756cb1e2d2f8c4d51648ae972f67c30957b
---
cmk_base/config.py | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/cmk_base/config.py b/cmk_base/config.py
index 6613082..07c9e56 100644
--- a/cmk_base/config.py
+++ b/cmk_base/config.py
@@ -126,6 +126,7 @@ def load(with_conf_d=True, validate_hosts=True, exclude_parents_mk=False):
_load_config(with_conf_d, exclude_parents_mk)
_transform_mgmt_config_vars_from_140_to_150()
+ _initialize_derived_config_variables()
_perform_post_config_loading_actions()
@@ -157,7 +158,6 @@ def _perform_post_config_loading_actions():
cmk_base.config_cache.clear_all()
initialize_config_caches()
- initialize_service_levels()
# In case the checks are not loaded yet it seems the current mode
# is not working with the checks. In this case also don't load the
@@ -264,12 +264,20 @@ def initialize_config_caches():
collect_hosttags()
-def initialize_service_levels():
+def _initialize_derived_config_variables():
global service_service_levels, host_service_levels
service_service_levels = extra_service_conf.get("_ec_sl", [])
host_service_levels = extra_host_conf.get("_ec_sl", [])
+def get_derived_config_variable_names():
+ """These variables are computed from other configuration variables and not configured directly.
+
+ The origin variable (extra_service_conf) should not be exported to the helper config. Only
+ the service levels are needed."""
+ return [ "service_service_levels", "host_service_levels" ]
+
+
def _verify_non_duplicate_hosts():
duplicates = duplicate_hosts()
if duplicates:
Module: check_mk
Branch: master
Commit: fd509de492a35e49fc6f535477a49b95f417c234
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fd509de492a35e…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri May 18 13:07:57 2018 +0200
Fixed check related variables not affecting check helpers on reload
* The check helper config was totally missing the configuration options
from the checks. This made reloads not set check related options.
* Initially the whole configuration was loaded instead of the check
helper config by accident. This made the helpers load at least the
check related configuration options during starting.
* This means: Initialisation during helper startup worked but later
reloads were not setting the possibly changed settings.
Change-Id: I48a2aa5c2f9c9b628d406ced53a7a2194480c32a
---
cmk_base/config.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/cmk_base/config.py b/cmk_base/config.py
index 07c9e56..7dc762b 100644
--- a/cmk_base/config.py
+++ b/cmk_base/config.py
@@ -119,8 +119,7 @@ def set_check_variables_for_checks():
# '----------------------------------------------------------------------'
def load(with_conf_d=True, validate_hosts=True, exclude_parents_mk=False):
- _add_check_variables_to_default_config()
- load_default_config()
+ _initialize_config()
vars_before_config = all_nonfunction_vars()
@@ -147,11 +146,19 @@ def load_packed_config():
The validations which are performed during load() also don't need to be performed.
"""
+ _initialize_config()
+
filepath = cmk.paths.var_dir + "/core/helper_config.mk"
exec(marshal.load(open(filepath)), globals())
+
_perform_post_config_loading_actions()
+def _initialize_config():
+ _add_check_variables_to_default_config()
+ load_default_config()
+
+
def _perform_post_config_loading_actions():
"""These tasks must be performed after loading the Check_MK base configuration"""
# First cleanup things (needed for e.g. reloading the config)
@@ -275,7 +282,7 @@ def get_derived_config_variable_names():
The origin variable (extra_service_conf) should not be exported to the helper config. Only
the service levels are needed."""
- return [ "service_service_levels", "host_service_levels" ]
+ return set([ "service_service_levels", "host_service_levels" ])
def _verify_non_duplicate_hosts():
Module: check_mk
Branch: master
Commit: 2d777004e8268f0daac84565dabea11e5c65f636
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2d777004e8268f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri May 18 14:29:36 2018 +0200
6103 FIX Check and discovery parameters were not always reloaded
Changed check specific check and discovery parameters were not
always updated during config reload ("Activate changes"). This
made the Check_MK and Check_MK Discovery services not recognize
the changed parameters when reloading the config. The parameters
were only loaded during next core restart.
This regression affected all previous 1.5 beta releases.
Change-Id: I95b299e6d7ceb434d4f16e3bbf6abc523474ae77
---
.werks/6103 | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/.werks/6103 b/.werks/6103
new file mode 100644
index 0000000..e30f4ff
--- /dev/null
+++ b/.werks/6103
@@ -0,0 +1,17 @@
+Title: Check and discovery parameters were not always reloaded
+Level: 2
+Component: core
+Class: fix
+Compatible: compat
+Edition: cee
+State: unknown
+Version: 1.6.0i1
+Date: 1526646381
+
+Changed check specific check and discovery parameters were not
+always updated during config reload ("Activate changes"). This
+made the Check_MK and Check_MK Discovery services not recognize
+the changed parameters when reloading the config. The parameters
+were only loaded during next core restart.
+
+This regression affected all previous 1.5 beta releases.
Module: check_mk
Branch: master
Commit: bc58607abd930d2567520e9a57d24bec03137b2d
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bc58607abd930d…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri May 18 11:55:02 2018 +0200
Fixed missing initialization of check config variables
Check related configuration variables were not correctly set in the
check contexts when checking is done using the Check_MK helpers of the
CMC.
Centralized post config loading things in the config module to prevent
similar trouble in the future.
Change-Id: Ib181bcb39b2091fd36d23c4b66bf6d5e9b80aa09
---
cmk_base/config.py | 55 ++++++++++++++++++++++++++++++++++--------------------
1 file changed, 35 insertions(+), 20 deletions(-)
diff --git a/cmk_base/config.py b/cmk_base/config.py
index 43df660..6613082 100644
--- a/cmk_base/config.py
+++ b/cmk_base/config.py
@@ -125,23 +125,51 @@ def load(with_conf_d=True, validate_hosts=True, exclude_parents_mk=False):
vars_before_config = all_nonfunction_vars()
_load_config(with_conf_d, exclude_parents_mk)
-
_transform_mgmt_config_vars_from_140_to_150()
- initialize_config_caches()
- initialize_service_levels()
+ _perform_post_config_loading_actions()
if validate_hosts:
_verify_non_duplicate_hosts()
- add_wato_static_checks_to_checks()
- initialize_check_caches()
- set_check_variables_for_checks()
-
verify_non_invalid_variables(vars_before_config)
verify_snmp_communities_type()
+def load_packed_config():
+ """Load the configuration for the CMK helpers of CMC
+
+ These files are written by cmk_base.cee.core_cmc.pack_config().
+
+ Should have a result similar to the load() above. With the exception that the
+ check helpers would only need check related config variables.
+
+ The validations which are performed during load() also don't need to be performed.
+ """
+ filepath = cmk.paths.var_dir + "/core/helper_config.mk"
+ exec(marshal.load(open(filepath)), globals())
+ _perform_post_config_loading_actions()
+
+
+def _perform_post_config_loading_actions():
+ """These tasks must be performed after loading the Check_MK base configuration"""
+ # First cleanup things (needed for e.g. reloading the config)
+ cmk_base.config_cache.clear_all()
+
+ initialize_config_caches()
+ initialize_service_levels()
+
+ # In case the checks are not loaded yet it seems the current mode
+ # is not working with the checks. In this case also don't load the
+ # static checks into the configuration.
+ # TODO: Clean this up. Shouldn't we move the "checks" stuff to the
+ # checks module?
+ if cmk_base.checks.check_info:
+ add_wato_static_checks_to_checks()
+ initialize_check_caches()
+ set_check_variables_for_checks()
+
+
def _load_config(with_conf_d, exclude_parents_mk):
import cmk_base.checks
helper_vars = {
@@ -256,14 +284,6 @@ def _verify_non_duplicate_hosts():
def add_wato_static_checks_to_checks():
global checks
- # In case the checks are not loaded yet it seems the current mode
- # is not working with the checks. In this case also don't load the
- # static checks into the configuration.
- # TODO: Clean this up. Shouldn't we move the "checks" stuff to the
- # checks module?
- if not cmk_base.checks.check_info:
- return
-
static = []
for entries in static_checks.values():
for entry in entries:
@@ -377,11 +397,6 @@ def _cmp_config_paths(a, b):
cmp(pa, pb)
-def load_packed_config():
- filepath = cmk.paths.var_dir + "/core/helper_config.mk"
- exec(marshal.load(open(filepath)), globals())
-
-
#.
# .--Host tags-----------------------------------------------------------.