Module: check_mk
Branch: master
Commit: 5f1dd7ed6bb7e58103bf9feaaf808b577b221a17
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5f1dd7ed6bb7e5…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Nov 20 09:51:57 2014 +0100
#1527 FIX Fixed views missing values of some filters (serviceregex, hostgroup filters,
...)
With the rewrite of the views/dashboards/visuals we introduced a mechanism of
transforming
views of the old format to the new format. This transform mechanism missed to transform
hard coded values of some filters where the variable names had been renamed.
The affected filters are:
'serviceregex'
'hostregex'
'hostgroupnameregex'
'servicegroupnameregex'
'opthostgroup'
'optservicegroup'
'hostgroup'
'servicegroup'
'host_contactgroup'
'service_contactgroup'
If you already have migrated to a previous release, which transformed your views and made
you miss these filters or hard coded values, you can install a version containing this
fix, remove the file <tt>var/check_mk/web/USER/user_views.mk</tt> from your
site and then
access the Web-GUI again. This should fix the problem. Be aware: By removing the
user_views.mk
all your changes to your views you made since the initial creation of the user_views.mk
will be reverted.
---
.werks/1527 | 31 +++++++++++++++++++++++++++++++
web/htdocs/views.py | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 82 insertions(+)
diff --git a/.werks/1527 b/.werks/1527
new file mode 100644
index 0000000..502c88e
--- /dev/null
+++ b/.werks/1527
@@ -0,0 +1,31 @@
+Title: Fixed views missing values of some filters (serviceregex, hostgroup filters, ...)
+Level: 1
+Component: multisite
+Compatible: compat
+Version: 1.2.5i6p3
+Date: 1416473103
+Class: fix
+
+With the rewrite of the views/dashboards/visuals we introduced a mechanism of
transforming
+views of the old format to the new format. This transform mechanism missed to transform
+hard coded values of some filters where the variable names had been renamed.
+
+The affected filters are:
+
+'serviceregex'
+'hostregex'
+'hostgroupnameregex'
+'servicegroupnameregex'
+'opthostgroup'
+'optservicegroup'
+'hostgroup'
+'servicegroup'
+'host_contactgroup'
+'service_contactgroup'
+
+If you already have migrated to a previous release, which transformed your views and
made
+you miss these filters or hard coded values, you can install a version containing this
+fix, remove the file <tt>var/check_mk/web/USER/user_views.mk</tt> from your
site and then
+access the Web-GUI again. This should fix the problem. Be aware: By removing the
user_views.mk
+all your changes to your views you made since the initial creation of the user_views.mk
+will be reverted.
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 8601980..b6f0d13 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -171,6 +171,7 @@ def transform_old_views():
# The exact match filters have been removed. They where used only as
# link filters anyway - at least by the builtin views.
continue
+
for var in f.htmlvars:
# Check whether or not the filter is supported by the datasource,
# then either skip or use the filter vars
@@ -179,6 +180,56 @@ def transform_old_views():
all_vars[var] = value
context[filter_name][var] = value
+ # We changed different filters since the visuals-rewrite. This must be
treated here, since
+ # we need to transform views which have been created with the old filter
var names.
+ # Changes which have been made so far:
+ changed_filter_vars = {
+ 'serviceregex': { # Name of the filter
+ # old var name: new var name
+ 'service': 'service_regex',
+ },
+ 'hostregex': {
+ 'host': 'host_regex',
+ },
+ 'hostgroupnameregex': {
+ 'hostgroup_name': 'hostgroup_regex',
+ },
+ 'servicegroupnameregex': {
+ 'servicegroup_name': 'servicegroup_regex',
+ },
+ 'opthostgroup': {
+ 'opthostgroup': 'opthost_group',
+ 'neg_opthostgroup': 'neg_opthost_group',
+ },
+ 'optservicegroup': {
+ 'optservicegroup': 'optservice_group',
+ 'neg_optservicegroup': 'neg_optservice_group',
+ },
+ 'hostgroup': {
+ 'hostgroup': 'host_group',
+ 'neg_hostgroup': 'neg_host_group',
+ },
+ 'servicegroup': {
+ 'servicegroup': 'service_group',
+ 'neg_servicegroup': 'neg_service_group',
+ },
+ 'host_contactgroup': {
+ 'host_contactgroup': 'host_contact_group',
+ 'neg_host_contactgroup':
'neg_host_contact_group',
+ },
+ 'service_contactgroup': {
+ 'service_contactgroup': 'service_contact_group',
+ 'neg_service_contactgroup':
'neg_service_contact_group',
+ },
+ }
+
+ if filter_name in changed_filter_vars and f.info in
datasource['infos']:
+ for old_var, new_var in changed_filter_vars[filter_name].items():
+ if old_var in filtervars:
+ value = filtervars[old_var]
+ all_vars[new_var] = value
+ context[filter_name][new_var] = value
+
# Now, when there are single object infos specified, add these keys to the
# context
for single_key in single_keys: