Module: check_mk
Branch: master
Commit: 473db9a63fb65734f19f94b2afb1412d9682b5a5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=473db9a63fb657…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Jan 13 11:03:43 2015 +0100
#1667 Sidebar snapin 'Tree of Folders' and 'WATO folder' filter now
available on slave sites
The multisite filter <i>WATO folder</i> was not available on slave sites with
disabled WATO.
The <i>Tree of Folders</i> snapin was available even if WATO was disabled.
If you clicked on a link on the <i>Tree of Folders</i> snapin the upcoming
page displayed
wrong information because the <i>WATO folder</i> filter was missing.
This has been fixed.
The new behaviour:
<ul>
<li>Slave site:<i>Tree of Folders</i> snapin is always
available</li>
<li>Slave site:<i>WATO folder</i> filter is always available</li>
<li>Master site:<i>Tree of Folders</i> snapin is not available if WATO
is disabled</li>
<li>Master site:<i>WATO folder</i> filter not available if WATO is
disabled</li>
</ul>
---
.werks/1667 | 22 ++++++++++++++++++++++
ChangeLog | 1 +
web/htdocs/visuals.py | 4 ++--
web/plugins/sidebar/wato.py | 9 +++++++++
web/plugins/visuals/wato.py | 7 ++++++-
5 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/.werks/1667 b/.werks/1667
new file mode 100644
index 0000000..96b6b2b
--- /dev/null
+++ b/.werks/1667
@@ -0,0 +1,22 @@
+Title: Sidebar snapin 'Tree of Folders' and 'WATO folder' filter now
available on slave sites
+Level: 1
+Component: multisite
+Class: feature
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1421142996
+
+The multisite filter <i>WATO folder</i> was not available on slave sites with
disabled WATO.
+The <i>Tree of Folders</i> snapin was available even if WATO was disabled.
+If you clicked on a link on the <i>Tree of Folders</i> snapin the upcoming
page displayed
+wrong information because the <i>WATO folder</i> filter was missing.
+This has been fixed.
+
+The new behaviour:
+<ul>
+<li>Slave site:<i>Tree of Folders</i> snapin is always
available</li>
+<li>Slave site:<i>WATO folder</i> filter is always
available</li>
+<li>Master site:<i>Tree of Folders</i> snapin is not available if WATO
is disabled</li>
+<li>Master site:<i>WATO folder</i> filter not available if WATO is
disabled</li>
+</ul>
diff --git a/ChangeLog b/ChangeLog
index 1e2fe51..ad00190 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -67,6 +67,7 @@
* 1776 Dashboard: Allowing unicode characters in static text dashlet
* 1210 New Downtime Filter for comments...
* 1811 Added new filter for regex based filtering of contacts to log based views...
+ * 1667 Sidebar snapin 'Tree of Folders' and 'WATO folder' filter now
available on slave sites...
* 1781 FIX: Fix broken grouping by host/service group in availability
* 1783 FIX: Finish the view "History of Scheduled Downtimes"...
* 1206 FIX: Hostname not longer shown as column in host views
diff --git a/web/htdocs/visuals.py b/web/htdocs/visuals.py
index e35205e..afc8b32 100644
--- a/web/htdocs/visuals.py
+++ b/web/htdocs/visuals.py
@@ -887,9 +887,9 @@ def filters_of_visual(visual, info_keys, show_all=False):
# add ubiquitary_filters that are possible for these infos
for fn in ubiquitary_filters:
# Disable 'wato_folder' filter, if WATO is disabled or there is a single
host view
- if fn == "wato_folder" and (not config.wato_enabled or 'host'
in visual['single_infos']):
- continue
filter = get_filter(fn)
+ if fn == "wato_folder" and (not filter.available() or 'host' in
visual['single_infos']):
+ continue
if not filter.info or filter.info in info_keys:
filters.append(filter)
diff --git a/web/plugins/sidebar/wato.py b/web/plugins/sidebar/wato.py
index afbf458..cb3adfc 100644
--- a/web/plugins/sidebar/wato.py
+++ b/web/plugins/sidebar/wato.py
@@ -212,6 +212,15 @@ def render_tree_folder(f, js_func):
def render_wato_foldertree():
+ is_slave_site = not wato.is_distributed() and
os.path.exists(defaults.check_mk_configdir + "/distributed_wato.mk")
+ if not is_slave_site:
+ if not config.wato_enabled:
+ html.write(_("WATO is disabled."))
+ return False
+ elif not config.may("wato.use"):
+ html.write(_("You are not allowed to use Check_MK's web
configuration GUI."))
+ return False
+
user_folders = compute_foldertree()
#
diff --git a/web/plugins/visuals/wato.py b/web/plugins/visuals/wato.py
index a910957..4185f7d 100644
--- a/web/plugins/visuals/wato.py
+++ b/web/plugins/visuals/wato.py
@@ -32,7 +32,12 @@ class FilterWatoFile(Filter):
self.last_wato_data_update = None
def available(self):
- return config.wato_enabled and wato.have_folders()
+ # This filter is also available on slave sites with disabled WATO
+ # To determine if this site is a slave we check the existance of the
distributed_wato.mk
+ # file and the absence of any site configuration
+ return (config.wato_enabled or\
+ (not wato.is_distributed() and os.path.exists(defaults.check_mk_configdir
+ "/distributed_wato.mk")))\
+ and wato.have_folders()
def load_wato_data(self):
self.tree = wato.get_folder_tree()