Module: check_mk
Branch: master
Commit: 1ef58b4976dc552473d175c09af254fe64782ea8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1ef58b4976dc55…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Nov 18 11:49:55 2014 +0100
#1501 FIX Legacy view formats created with 2014-09 snapshots are now converted
Views which have been created with Check_MK snapshots from 2014-09 created
the views in a legacy format which the current multisite code can not interpret.
When an installation has such a view created by any user, ist ot usable anymore
and shows an exception like "if 'service' in hide_filters and 'host'
in hide_filters:
TypeError: argument of type 'NoneType' is not iterable".
This has been fixed now. The legacy views are now converted automatically.
They are saved in the new format once the user makes his first change to this
or another view.
---
.werks/1501 | 18 ++++++++++++++++++
ChangeLog | 1 +
web/htdocs/views.py | 17 ++++++++++++++---
3 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/.werks/1501 b/.werks/1501
new file mode 100644
index 0000000..c376c52
--- /dev/null
+++ b/.werks/1501
@@ -0,0 +1,18 @@
+Title: Legacy view formats created with 2014-09 snapshots are now converted
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.5i7
+Date: 1416307562
+
+Views which have been created with Check_MK snapshots from 2014-09 created
+the views in a legacy format which the current multisite code can not interpret.
+When an installation has such a view created by any user, ist ot usable anymore
+and shows an exception like "if 'service' in hide_filters and 'host'
in hide_filters:
+TypeError: argument of type 'NoneType' is not iterable".
+
+This has been fixed now. The legacy views are now converted automatically.
+They are saved in the new format once the user makes his first change to this
+or another view.
diff --git a/ChangeLog b/ChangeLog
index a1d651a..3398a48 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -52,6 +52,7 @@
* 1496 FIX: Fixed exception after editing a dashboard as user without permission to
publish dashboards...
* 1436 FIX: quicksearch: search with multiple patterns (h: / s:) no longer discards
the host pattern...
* 1438 FIX: quicksearch: fixed various non-working quicksearch filters...
+ * 1501 FIX: Legacy view formats created with 2014-09 snapshots are now converted...
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 d5ce70b..8601980 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -100,9 +100,20 @@ def transform_old_views():
if "context" not in view: # legacy views did not have this explicitly
view.setdefault("user_sortable", True)
- # This tries to map the datasource and additional settings of the
- # views to get the correct view context
- if 'single_infos' not in view:
+ if 'context_type' in view:
+ # This code transforms views from user_views.mk which have been migrated
with
+ # daily snapshots from 2014-08 till beginning 2014-10.
+ if view['context_type'] in [ 'host', 'service',
'hostgroup', 'servicegroup' ]:
+ view['single_infos'] = [view['context_type']]
+ else:
+ view['single_infos'] = [] # drop the context type and assume a
"multiple view"
+ del view['context_type']
+
+ elif 'single_infos' not in view:
+ # This tries to map the datasource and additional settings of the
+ # views to get the correct view context
+ #
+ # This code transforms views from views.mk (legacy format) to the current
format
try:
hide_filters = view.get('hide_filters')