Module: check_mk
Branch: master
Commit: 43b21eccfb282041cabe82bc1d173d1505a3f9d6
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=43b21eccfb2820…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Mon Mar 26 11:22:07 2018 +0200
Centralized legacy contact_group conversion.
Change-Id: I3f44399f03d94bf943e2ba08525a48d350237c44
---
cmk/ec/export.py | 10 ++++++++++
cmk/ec/main.py | 10 ----------
web/plugins/wato/mkeventd.py | 10 ----------
3 files changed, 10 insertions(+), 20 deletions(-)
diff --git a/cmk/ec/export.py b/cmk/ec/export.py
index 25a9913..ab6b53f 100644
--- a/cmk/ec/export.py
+++ b/cmk/ec/export.py
@@ -228,6 +228,16 @@ def load_config(settings):
cmk.ec.defaults.default_rule_pack(config["rules"])]
config["rules"] = []
+ # Convert old contact_groups config
+ for rule_pack in config["rule_packs"]:
+ for rule in rule_pack["rules"]:
+ if isinstance(rule.get("contact_groups"), list):
+ rule["contact_groups"] = {
+ "groups": rule["contact_groups"],
+ "notify": False,
+ "precedence": "host",
+ }
+
return config
diff --git a/cmk/ec/main.py b/cmk/ec/main.py
index a29c754..4d2a6a9 100644
--- a/cmk/ec/main.py
+++ b/cmk/ec/main.py
@@ -4964,16 +4964,6 @@ def load_configuration(settings):
g_slave_status["mode"])
load_master_config(settings)
- # Convert old contact_groups config
- for rule_pack in g_config["rule_packs"]:
- for rule in rule_pack["rules"]:
- if type(rule.get("contact_groups")) == list:
- rule["contact_groups"] = {
- "groups": rule["contact_groups"],
- "notify": False,
- "precedence": "host",
- }
-
# Create dictionary for actions for easy access
g_config["action"] = {}
for action in g_config["actions"]:
diff --git a/web/plugins/wato/mkeventd.py b/web/plugins/wato/mkeventd.py
index 058b09a..aa07226 100644
--- a/web/plugins/wato/mkeventd.py
+++ b/web/plugins/wato/mkeventd.py
@@ -1003,16 +1003,6 @@ def load_mkeventd_rules():
pack_hits += hits
rule_pack["hits"] = pack_hits
- # Migrate old contact_group key (+ add False for notify option)
- for rule_pack in rule_packs:
- for rule in rule_pack["rules"]:
- if type(rule.get("contact_groups")) == list:
- rule["contact_groups"] = {
- "groups" : rule["contact_groups"],
- "notify" : False,
- "precedence" : "host",
- }
-
return rule_packs