Module: check_mk
Branch: master
Commit: d910c5a8b2ba8cd08fa98d141b8207fba8871e0a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d910c5a8b2ba8c…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Apr 26 08:43:04 2019 +0200
Move state translation ruleset processing to HostConfig/ConfigCache
CMK-2030
Change-Id: I9d6eee3400e21138a49fc08630e9d6beac4438d7
---
cmk_base/config.py | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/cmk_base/config.py b/cmk_base/config.py
index 943dd7c..68ab3ad 100644
--- a/cmk_base/config.py
+++ b/cmk_base/config.py
@@ -3643,6 +3643,15 @@ class CEEConfigCache(ConfigCache):
return False
return entries[0]
+ def state_translation_of_service(self, hostname, description):
+ # type: (str, Text) -> Dict
+ entries = self.service_extra_conf(hostname, description,
service_state_translation)
+
+ spec = {} # type: Dict
+ for entry in entries[::-1]:
+ spec.update(entry)
+ return spec
+
# TODO: Find a clean way to move this to cmk_base.cee. This will be possible once the
# configuration settings are not held in cmk_base.config namespace anymore.
@@ -3679,3 +3688,13 @@ class CEEHostConfig(HostConfig):
if not entries:
return False
return entries[0]
+
+ @property
+ def state_translation(self):
+ # type: () -> Dict
+ entries = self._config_cache.host_extra_conf(self.hostname,
host_state_translation)
+
+ spec = {} # type: Dict
+ for entry in entries[::-1]:
+ spec.update(entry)
+ return spec