Module: check_mk
Branch: master
Commit: f6ea074807cb125d7eea4ba0de27d66293190658
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f6ea074807cb12…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri May 18 08:21:27 2018 +0200
6102 FIX Web API: set_ruleset call adds a config change log entry now
Change-Id: I6ab568bc92c09f6a06c0dc941cc88aa5dc2d7ced
---
.werks/6102 | 11 +++++++++++
web/plugins/webapi/webapi.py | 8 ++++++++
2 files changed, 19 insertions(+)
diff --git a/.werks/6102 b/.werks/6102
new file mode 100644
index 0000000..882283d
--- /dev/null
+++ b/.werks/6102
@@ -0,0 +1,11 @@
+Title: Web API: set_ruleset call adds a config change log entry now
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1526624429
+
+
diff --git a/web/plugins/webapi/webapi.py b/web/plugins/webapi/webapi.py
index cce2963..65d0309 100644
--- a/web/plugins/webapi/webapi.py
+++ b/web/plugins/webapi/webapi.py
@@ -767,6 +767,10 @@ class APICallRules(APICallCollection):
folder_rulesets = watolib.FolderRulesets(folder)
folder_rulesets.load()
+ # TODO: This add_change() call should be made by the data classes
+ watolib.add_change("edit-ruleset", _("Set ruleset '%s'
for '%s' with %d rules") %
+ (new_ruleset.title(), folder.title(), len(rules)),
+ sites=folder.all_site_ids())
folder_rulesets.set(ruleset_name, new_ruleset)
folder_rulesets.save()
@@ -775,6 +779,10 @@ class APICallRules(APICallCollection):
for folder_path in folders_obsolete_ruleset:
folder = watolib.Folder.folder(folder_path)
new_ruleset = watolib.FolderRulesets(ruleset_name)
+ # TODO: This add_change() call should be made by the data classes
+ watolib.add_change("edit-ruleset", _("Deleted ruleset
'%s' for '%s'") %
+ (new_ruleset.title(), folder.title()),
+ sites=folder.all_site_ids())
new_ruleset.from_config(folder, [])
new_ruleset.save()