Module: check_mk
Branch: master
Commit: 2985e3fa9302da7f317d4e2bf51ba61eb19eb640
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2985e3fa9302da…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Feb 3 15:48:19 2016 +0100
#3046 FIX Acknowledging all incompatible werks when creating new sites
---
.werks/3046 | 9 +++++++++
ChangeLog | 1 +
web/htdocs/wato.py | 5 +++++
web/htdocs/werks.py | 18 +++++++++++-------
4 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/.werks/3046 b/.werks/3046
new file mode 100644
index 0000000..96bf4ca
--- /dev/null
+++ b/.werks/3046
@@ -0,0 +1,9 @@
+Title: Acknowledging all incompatible werks when creating new sites
+Level: 1
+Component: multisite
+Compatible: compat
+Version: 1.2.7i4
+Date: 1454510874
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 3f6e4fe..b868396 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -296,6 +296,7 @@
* 3035 FIX: Fixed broken graph preview when hovering graph icon in Check_MK Raw
Edition
* 3040 FIX: Removed all summary_hosts related filters from shipped views...
* 3041 FIX: Fixed deselecting view checkbox options like "Always show
checkboxes" in dashboard embedded views
+ * 3046 FIX: Acknowledging all incompatible werks when creating new sites
WATO:
* 2442 WATO remove host: improved cleanup of obsolete host files...
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 1242d49..736e571 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -14035,6 +14035,11 @@ def create_sample_config():
except:
pass # silently ignore building errors here
+ # This is not really the correct place for such kind of action, but the best place we
could
+ # find to execute it only for new created sites.
+ import werks
+ werks.acknowledge_all_werks()
+
#.
# .--Pattern Editor------------------------------------------------------.
# | ____ _ _ _____ _ _ _ |
diff --git a/web/htdocs/werks.py b/web/htdocs/werks.py
index f163aac..76c1e46 100644
--- a/web/htdocs/werks.py
+++ b/web/htdocs/werks.py
@@ -99,10 +99,14 @@ def handle_acknowledgement():
if werk["compatible"] == "incomp_unack":
acknowledge_werk(werk)
html.message(HTML(_("Werk %s - %s has been acknowledged.") %
(render_werk_id(werk, with_link=True), render_werk_title(werk))))
+ html.reload_sidebar()
elif html.var("_ack_all"):
if (html.confirm(_("Do you really want to acknowledge <b>all</b>
incompatible werks?"), method="GET")):
+ num = len(unacknowledged_incompatible_werks())
acknowledge_all_werks()
+ html.message(_("%d incompatible Werks have been acknowledged.") %
num)
+ html.reload_sidebar()
render_unacknowleged_werks()
@@ -177,9 +181,14 @@ def may_acknowledge():
def acknowledge_werk(werk):
+ acknowledge_werks([werk])
+
+
+def acknowledge_werks(werks):
config.need_permission("general.acknowledge_werks")
ack_ids = load_acknowledgements()
- ack_ids.append(werk["id"])
+ for werk in werks:
+ ack_ids.append(werk["id"])
werk["compatible"] = "incomp_ack"
save_acknowledgements(ack_ids)
@@ -189,12 +198,7 @@ def save_acknowledgements(acknowledged_werks):
def acknowledge_all_werks():
- num = 0
- for werk in g_werks.values():
- if werk["compatible"] == "incomp_unack":
- acknowledge_werk(werk)
- num += 1
- html.message(_("%d incompatible Werks have been acknowledged.") % num)
+ acknowledge_werks(unacknowledged_incompatible_werks())
def werk_is_pre_127(werk):