Module: check_mk
Branch: master
Commit: 98f61c8869705a5240bbb22e3a3c6e4013fc2344
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=98f61c8869705a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Apr 25 21:43:54 2019 +0200
Move recurring downtime ruleset processing to HostConfig/ConfigCache
CMK-2030
Change-Id: I3399712fa3de91b6a28d17675777628683a4067c
---
cmk_base/config.py | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/cmk_base/config.py b/cmk_base/config.py
index 92681db..3af05ac 100644
--- a/cmk_base/config.py
+++ b/cmk_base/config.py
@@ -2875,6 +2875,8 @@ class HostConfig(object):
# +----------------------------------------------------------------------+
+# TODO: Shouldn't we find a better place for the *_of_service() methods?
+# Wouldn't it be better to make them part of HostConfig?
class ConfigCache(object):
def __init__(self):
super(ConfigCache, self).__init__()
@@ -3621,6 +3623,10 @@ class CEEConfigCache(ConfigCache):
return rrdconf[0]
+ def recurring_downtimes_of_service(self, hostname, description):
+ # type: (str, Text) -> List[Dict[str, Union[int, str]]]
+ return self.service_extra_conf(hostname, description,
service_recurring_downtimes)
+
# 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.
@@ -3634,3 +3640,8 @@ class CEEHostConfig(HostConfig):
if not entries:
return None
return entries[0]
+
+ @property
+ def recurring_downtimes(self):
+ # type: () -> List[Dict[str, Union[int, str]]]
+ return self._config_cache.host_extra_conf(self.hostname,
host_recurring_downtimes)