Module: check_mk
Branch: master
Commit: c754d517298382e1a0912715532313440bada6c4
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c754d517298382…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Apr 23 20:36:10 2019 +0200
Cleanup config.get_explicit_service_custom_variables
CMK-2030
Change-Id: Ib098a7215e07740d89633720073662b61d3a325f
---
cmk_base/config.py | 17 +++++++----------
cmk_base/core_config.py | 4 ++--
2 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/cmk_base/config.py b/cmk_base/config.py
index 0cb4879..7d719fe 100644
--- a/cmk_base/config.py
+++ b/cmk_base/config.py
@@ -727,16 +727,6 @@ def _host_is_member_of_site(config_cache, hostname, site):
#
-# Explicit custom variables
-#
-def get_explicit_service_custom_variables(hostname, description):
- try:
- return explicit_service_custom_variables[(hostname, description)]
- except KeyError:
- return {}
-
-
-#
# Misc
#
@@ -2832,6 +2822,13 @@ class ConfigCache(object):
})
return labels
+ def get_explicit_service_custom_variables(self, hostname, description):
+ # type: (str, Text) -> Dict[str, str]
+ try:
+ return explicit_service_custom_variables[(hostname, description)]
+ except KeyError:
+ return {}
+
def ruleset_match_object_of_service(self, hostname, svc_desc):
# type: (str, Text) -> RulesetMatchObject
"""Construct the dictionary object that is needed to match this
service to rulesets
diff --git a/cmk_base/core_config.py b/cmk_base/core_config.py
index 7f75278..83e7b0c 100644
--- a/cmk_base/core_config.py
+++ b/cmk_base/core_config.py
@@ -358,8 +358,8 @@ def _extra_service_attributes(hostname, description, config_cache,
checkname, pa
attrs[key] = values[0]
# Add explicit custom_variables
- for varname, value in config.get_explicit_service_custom_variables(hostname,
-
description).iteritems():
+ for varname, value in config_cache.get_explicit_service_custom_variables(
+ hostname, description).iteritems():
attrs["_%s" % varname.upper()] = value
# Add custom user icons and actions