Module: check_mk
Branch: master
Commit: d6dc7766f57dbb4c826faca94438bddf400e4774
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d6dc7766f57dbb…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Dec 13 10:16:21 2011 +0100
Allow dict params without factory settings
---
modules/check_mk.py | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 609b1e5..4d8c9d5 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -4124,14 +4124,18 @@ def compute_check_parameters(host, checktype, item, params):
if type(fs) == dict:
params = {}
- # Honor factory settings for dict-type checks
- if def_levels_varname and type(params) == dict:
+ # Honor factory settings for dict-type checks. Merge
+ # dict type checks with multiple matching rules
+ if type(params) == dict:
# Start with factory settings
- new_params = factory_settings.get(def_levels_varname, {}).copy()
+ if def_levels_varname:
+ new_params = factory_settings.get(def_levels_varname, {}).copy()
+ else:
+ new_params = {}
# Merge user's default settings onto it
- if def_levels_varname in globals():
+ if def_levels_varname and (def_levels_varname in globals()):
def_levels = eval(def_levels_varname)
if type(def_levels) == dict:
new_params.update(eval(def_levels_varname))
@@ -4151,7 +4155,7 @@ def compute_check_parameters(host, checktype, item, params):
if len(entries) > 0:
# loop from last to first (first must have precedence)
for entry in entries[::-1]:
- if def_levels_varname and type(entry) == dict:
+ if type(params) == dict and type(entry) == dict:
params.update(entry)
else:
params = entry