Module: check_mk
Branch: master
Commit: 149a9298ceb3fe5ff3084cb541854095bd7cccd2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=149a9298ceb3fe…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Mon Mar 26 16:11:52 2018 +0200
Save/export of rule pack takes care of directory creation itself.
Change-Id: Ia7e20882d2c93d23c91561ea4ad9da53275a1e6f
---
cmk/ec/export.py | 8 ++++----
web/plugins/wato/mkeventd.py | 2 --
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/cmk/ec/export.py b/cmk/ec/export.py
index ab6b53f..79ba2d7 100644
--- a/cmk/ec/export.py
+++ b/cmk/ec/export.py
@@ -264,8 +264,8 @@ def save_rule_packs(rule_packs, pretty_print=False, dir_=None):
if not dir_:
dir_ = rule_pack_dir()
- file_ = str(dir_ / "rules.mk")
- cmk.store.save_file(file_, output)
+ dir_.mkdir(parents=True, exist_ok=True)
+ cmk.store.save_file(str(dir_ / "rules.mk"), output)
# NOTE: It is essential that export_rule_pack() is called *before*
@@ -298,8 +298,8 @@ def export_rule_pack(rule_pack, pretty_print=False, dir_=None):
if not dir_:
dir_ = mkp_rule_pack_dir()
- file_ = str(dir_ / ("%s.mk" % rule_pack['id']))
- cmk.store.save_file(file_, output)
+ dir_.mkdir(parents=True, exist_ok=True)
+ cmk.store.save_file(str(dir_ / ("%s.mk" % rule_pack['id'])),
output)
def add_rule_pack_proxies(file_names):
diff --git a/web/plugins/wato/mkeventd.py b/web/plugins/wato/mkeventd.py
index aa07226..c5e5b3b 100644
--- a/web/plugins/wato/mkeventd.py
+++ b/web/plugins/wato/mkeventd.py
@@ -1007,12 +1007,10 @@ def load_mkeventd_rules():
def save_mkeventd_rules(rule_packs):
- make_nagios_directories(str(ec.rule_pack_dir()))
ec.save_rule_packs(rule_packs, config.mkeventd_pprint_rules)
def export_mkp_rule_pack(rule_pack):
- make_nagios_directories(str(ec.mkp_rule_pack_dir()))
ec.export_rule_pack(rule_pack, config.mkeventd_pprint_rules)