Module: check_mk
Branch: master
Commit: 823676ebdb401d6632024a36a49f534d408e250a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=823676ebdb401d…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Mon Mar 26 08:57:10 2018 +0200
Consistently use cmk.ec.defaults.
Change-Id: If6fa299ca5b5e5b4e999a1eccd717abe94a8b37a
---
cmk/ec/defaults.py | 4 ++--
cmk/ec/export.py | 8 ++------
web/htdocs/mkeventd.py | 11 +++--------
3 files changed, 7 insertions(+), 16 deletions(-)
diff --git a/cmk/ec/defaults.py b/cmk/ec/defaults.py
index 2c9a2bf..4b8e2f0 100644
--- a/cmk/ec/defaults.py
+++ b/cmk/ec/defaults.py
@@ -42,7 +42,7 @@ except NameError:
def default_rule_pack(rules):
- # type: (List[Dict[str, Any]]) -> Dict[str, object]
+ # type: (List[Dict[str, Any]]) -> Dict[str, Any]
"""Returns the default rule pack"""
return {
"id": "default",
@@ -53,7 +53,7 @@ def default_rule_pack(rules):
def default_config():
- # type: () -> Dict[str, object]
+ # type: () -> Dict[str, Any]
"""Returns the default configuration"""
return {
"rules": [], # old pre 1.2.7i1 format. Only used if
rule_packs is empty
diff --git a/cmk/ec/export.py b/cmk/ec/export.py
index 23863bd..12e6b67 100644
--- a/cmk/ec/export.py
+++ b/cmk/ec/export.py
@@ -212,12 +212,8 @@ def load_rule_packs():
a site. Proxy objects in the rule packs are already bound to the referenced
object.
"""
- context = {
- "MkpRulePackProxy": MkpRulePackProxy,
- "rules": [],
- "rule_packs": [],
- "mkp_rule_packs": {}
- } # type: Dict[str, Any]
+ context = cmk.ec.defaults.default_config()
+ context["MkpRulePackProxy"] = MkpRulePackProxy
for path in [rule_pack_dir() / "rules.mk"] +
sorted(mkp_rule_pack_dir().glob('*.mk')):
cmk.store.load_mk_file(str(path), context)
diff --git a/web/htdocs/mkeventd.py b/web/htdocs/mkeventd.py
index 4cec8d2..edf0faa 100644
--- a/web/htdocs/mkeventd.py
+++ b/web/htdocs/mkeventd.py
@@ -36,6 +36,7 @@ import sites
from lib import *
import cmk.paths
import cmk.ec.settings
+import cmk.ec.defaults
import cmk.ec.export
import cmk.store
@@ -147,14 +148,8 @@ def eventd_configuration():
if cached_config and cached_config[0] is html:
return cached_config[1]
- config = {
- "MkpRulePackProxy": cmk.ec.export.MkpRulePackProxy,
- "rules": [],
- "rule_packs": [],
- "mkp_rule_packs": {},
- "debug_rules": False,
- }
-
+ config = cmk.ec.defaults.default_config()
+ config["MkpRulePackProxy"] = cmk.ec.export.MkpRulePackProxy
settings = cmk.ec.settings.settings('',
Path(cmk.paths.omd_root),
Path(cmk.paths.default_config_dir),