Module: check_mk
Branch: master
Commit: 044252e4051e58bcb9c5646e879e67063b270bbf
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=044252e4051e58…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri May 18 17:52:31 2018 +0200
6104 FIX Fixed not available global settings page when check specific variable configured
The global settings page was only showing an error message like "General error:
Invalid configuration variable 'lnx_thermal_default_levels'" in case a check
specific configuration option has been set in Check_MK configuration.
Change-Id: I6a7133b3d7f886dbafae177b65d97c7b1495af88
---
.werks/6104 | 13 +++++++++++++
cmk_base/checks.py | 15 ++++++++++++++-
cmk_base/config.py | 9 +++++----
3 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/.werks/6104 b/.werks/6104
new file mode 100644
index 0000000..e86fd73
--- /dev/null
+++ b/.werks/6104
@@ -0,0 +1,13 @@
+Title: Fixed not available global settings page when check specific variable configured
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1526658656
+
+The global settings page was only showing an error message like "General error:
+Invalid configuration variable 'lnx_thermal_default_levels'" in case a
check
+specific configuration option has been set in Check_MK configuration.
diff --git a/cmk_base/checks.py b/cmk_base/checks.py
index e956c91..c48d3c7 100644
--- a/cmk_base/checks.py
+++ b/cmk_base/checks.py
@@ -74,6 +74,7 @@ special_agent_info = {}
_check_variables = {}
# keeps the default values of all the check variables
_check_variable_defaults = {}
+_all_checks_loaded = False
# workaround: set of check-groups that are to be treated as service-checks even if
# the item is None
@@ -94,15 +95,22 @@ service_rule_groups = set([
# | Loading of check plugins |
# '----------------------------------------------------------------------'
-# Load all checks and includes
def load():
+ """Load all checks and includes"""
+ global _all_checks_loaded
+
_initialize_data_structures()
filelist = get_plugin_paths(cmk.paths.local_checks_dir, cmk.paths.checks_dir)
load_checks(filelist)
+ _all_checks_loaded = True
+
def _initialize_data_structures():
"""Initialize some data structures which are populated while loading
the checks"""
+ global _all_checks_loaded
+ _all_checks_loaded = False
+
_check_variables.clear()
_check_variable_defaults.clear()
@@ -219,6 +227,11 @@ def load_checks(filelist):
initialize_check_type_caches()
+def all_checks_loaded():
+ """Whether or not all(!) checks have been loaded into the current
process"""
+ return _all_checks_loaded
+
+
# Constructs a new check context dictionary. It contains the whole check API.
def new_check_context():
# Add the data structures where the checks register with Check_MK
diff --git a/cmk_base/config.py b/cmk_base/config.py
index 7dc762b..54f02dc 100644
--- a/cmk_base/config.py
+++ b/cmk_base/config.py
@@ -132,7 +132,10 @@ def load(with_conf_d=True, validate_hosts=True,
exclude_parents_mk=False):
if validate_hosts:
_verify_non_duplicate_hosts()
- verify_non_invalid_variables(vars_before_config)
+ # Such validation only makes sense when all checks have been loaded
+ if cmk_base.checks.all_checks_loaded():
+ verify_non_invalid_variables(vars_before_config)
+
verify_snmp_communities_type()
@@ -169,9 +172,7 @@ def _perform_post_config_loading_actions():
# 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:
+ if cmk_base.checks.all_checks_loaded():
add_wato_static_checks_to_checks()
initialize_check_caches()
set_check_variables_for_checks()