Module: check_mk
Branch: master
Commit: 83b1c79dc95edba0ad0451ba3aebd44324707f25
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=83b1c79dc95edb…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Dec 1 09:41:46 2014 +0100
#1543 FIX Hosttag columns are now available right ater creating a tag
In previous versions you had to restart the webserver before the tag
related columns were available. Also cleaned up names of the column titles.
---
.bugs/2187 | 7 +++++--
.werks/1543 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/views.py | 4 ++++
web/plugins/sidebar/shipped.py | 6 ------
web/plugins/views/painters.py | 40 +++++++++++++++++++++++++++-------------
6 files changed, 47 insertions(+), 21 deletions(-)
diff --git a/.bugs/2187 b/.bugs/2187
index 1ca48cf..dfa6565 100644
--- a/.bugs/2187
+++ b/.bugs/2187
@@ -1,12 +1,15 @@
Title: Host tag painters missing after new tags have been created
Component: multisite
-State: open
+Class: bug
+State: done
Date: 2014-10-16 10:53:29
Targetversion: 1.2.5i1
-Class: bug
If you create a new host tag group in WATO then the according
Multisite painter for that tag is not present. It needs an
Apache reload. Seems that the automatic creation of painters for
the host tag groups is just done once one the module is being
loaded.
+
+2014-12-01 09:40:18: changed state open -> done
+Fixed.
diff --git a/.werks/1543 b/.werks/1543
new file mode 100644
index 0000000..94df177
--- /dev/null
+++ b/.werks/1543
@@ -0,0 +1,10 @@
+Title: Hosttag columns are now available right ater creating a tag
+Level: 1
+Component: multisite
+Compatible: compat
+Version: 1.2.5i7
+Date: 1417423222
+Class: fix
+
+In previous versions you had to restart the webserver before the tag
+related columns were available. Also cleaned up names of the column titles.
diff --git a/ChangeLog b/ChangeLog
index becbc9d..80be8df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -80,6 +80,7 @@
* 1537 FIX: Added transformation code for user dashboards created between 2014-08 and
2014-10...
* 1538 FIX: Only allow switching sites on/off when permitted to...
* 1539 FIX: Fixed refreshing of PNP graphs in dashboards...
+ * 1543 FIX: Hosttag columns are now available right ater creating a tag...
WATO:
* 1170 Added buttons to move rules to top/bottom of the list to ruleset edit dialog
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index fb601f9..b8f46ae 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -41,7 +41,11 @@ loaded_with_language = False
# Load all view plugins
def load_plugins():
global loaded_with_language
+
if loaded_with_language == current_language:
+ # always reload the hosttag painters, because new hosttags might have been
+ # added during runtime
+ load_host_tag_painters()
return
global multisite_datasources ; multisite_datasources = {}
diff --git a/web/plugins/sidebar/shipped.py b/web/plugins/sidebar/shipped.py
index fb498a4..1fb38a4 100644
--- a/web/plugins/sidebar/shipped.py
+++ b/web/plugins/sidebar/shipped.py
@@ -1257,12 +1257,6 @@ if defaults.omd_root:
# | |
# '----------------------------------------------------------------------'
-def parse_hosttag_title(title):
- if '/' in title:
- return title.split('/', 1)
- else:
- return None, title
-
def compute_tag_tree(taglist):
html.live.set_prepend_site(True)
query = "GET hosts\n" \
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index 172bbcf..f264933 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -1941,16 +1941,30 @@ def groupby_host_tag(row, tgid):
cssclass, title = paint_host_tag(row, tgid)
return title
-for entry in config.wato_host_tags:
- tgid = entry[0]
- tit = entry[1]
- ch = entry[2]
-
- multisite_painters["host_tag_" + tgid] = {
- "title" : _("Host tag:") + ' ' + tit,
- "short" : tit,
- "columns" : [ "host_custom_variables" ],
- "paint" : paint_host_tag,
- "groupby" : groupby_host_tag,
- "args" : [ tgid ],
- }
+def load_host_tag_painters():
+ # first remove all old painters to reflect delted painters during runtime
+ for key in multisite_painters.keys():
+ if key.startswith('host_tag_'):
+ del multisite_painters[key]
+
+ for entry in config.wato_host_tags:
+ tgid = entry[0]
+ tit = entry[1]
+ ch = entry[2]
+
+ long_tit = tit
+ if '/' in tit:
+ topic, tit = tit.split('/', 1)
+ if topic:
+ long_tit = topic + ' / ' + tit
+ else:
+ long_tit = tit
+
+ multisite_painters["host_tag_" + tgid] = {
+ "title" : _("Host tag:") + ' ' + long_tit,
+ "short" : tit,
+ "columns" : [ "host_custom_variables" ],
+ "paint" : paint_host_tag,
+ "groupby" : groupby_host_tag,
+ "args" : [ tgid ],
+ }