Module: check_mk
Branch: master
Commit: 7bb5167d13f4249e216b88e762522681903b1ce5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7bb5167d13f424…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Mon Nov 12 12:47:51 2018 +0100
6417 FIX Users may disable notifications by accident after upgrading to 1.5.0
Due to a rendering issue in the personal settings the option "Temporarily disable
all notifications" is always set in the GUI when a user or admin edits the settings
for the first time after an update to version 1.5.0.
If the user or admin then saves the settings and does not enable the notifications,
the setting is saved and the user does not receive notifications anymore. If a
user profile was not modified after an update, notifications worked as expected.
If a profile is saved for the first time after an update, the old configuration
file format is transformed to the new format. After that the setting is rendered
correctly.
To circumvent any problems please make sure that the notification settings of all
users are set properly after the update and that the settings are saved at least
once with the correct value.
For a large amount of users it may be tedious to change the settings off all users.
In this case it may be more straight forward to edit the file
~/etc/check_mk/conf.d/wato/contacts.mk directly. In the file all values for the key
"disable_notifications" have to be modified. The old value "True" has
to be replaced
by the dictionary "{'disable': True}" and the old value
"False" has to be replaced
by the empty dictionary "{}".
The issue is fixed in version 1.5.0p8. If you update from 1.4.0 to a version
= 1.5.0p8 you are not affected by this issue.
Change-Id: I89c7641133caedb966636d88a2a75c9af30362c5
---
.werks/6417 | 34 +++++++++++++++++++++++++++++++
cmk/gui/plugins/userdb/user_attributes.py | 14 +++++++------
cmk_base/notify.py | 1 -
3 files changed, 42 insertions(+), 7 deletions(-)
diff --git a/.werks/6417 b/.werks/6417
new file mode 100644
index 0000000..e4f8265
--- /dev/null
+++ b/.werks/6417
@@ -0,0 +1,34 @@
+Title: Users may disable notifications by accident after upgrading to 1.5.0
+Level: 2
+Component: notifications
+Class: fix
+Compatible: incomp
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1542012103
+
+Due to a rendering issue in the personal settings the option "Temporarily disable
+all notifications" is always set in the GUI when a user or admin edits the settings
+for the first time after an update to version 1.5.0.
+
+If the user or admin then saves the settings and does not enable the notifications,
+the setting is saved and the user does not receive notifications anymore. If a
+user profile was not modified after an update, notifications worked as expected.
+If a profile is saved for the first time after an update, the old configuration
+file format is transformed to the new format. After that the setting is rendered
+correctly.
+
+To circumvent any problems please make sure that the notification settings of all
+users are set properly after the update and that the settings are saved at least
+once with the correct value.
+
+For a large amount of users it may be tedious to change the settings off all users.
+In this case it may be more straight forward to edit the file
+~/etc/check_mk/conf.d/wato/contacts.mk directly. In the file all values for the key
+"disable_notifications" have to be modified. The old value "True" has
to be replaced
+by the dictionary "{'disable': True}" and the old value
"False" has to be replaced
+by the empty dictionary "{}".
+
+The issue is fixed in version 1.5.0p8. If you update from 1.4.0 to a version
+
= 1.5.0p8 you are not affected by this issue.
diff --git a/cmk/gui/plugins/userdb/user_attributes.py
b/cmk/gui/plugins/userdb/user_attributes.py
index b14400d..66e699a 100644
--- a/cmk/gui/plugins/userdb/user_attributes.py
+++ b/cmk/gui/plugins/userdb/user_attributes.py
@@ -103,11 +103,11 @@ class DisableNotificationsUserAttribute(UserAttribute):
return Transform(
Dictionary(
title=_("Disable Notifications"),
- help=_("When this option is active the you will not get
<b>any</b> "
+ help=_("When this option is active you will not get
<b>any</b> "
"alerts or other notifications via email, SMS or similar.
"
- "This overrides all other notification settings or rules, so
make "
- "sure that you know what you do. Moreover you can customize a
timerange "
- "within no notifications are generated."),
+ "This overrides all other notification settings and rules, so
make "
+ "sure that you know what you do. Moreover you can specify a
timerange "
+ "where no notifications are generated."),
elements=[("disable",
FixedValue(
True,
@@ -125,8 +125,10 @@ class DisableNotificationsUserAttribute(UserAttribute):
forth=self._transform_disable_notification)
def _transform_disable_notification(self, p):
- if not isinstance(p, dict):
- return {"disable": True}
+ if isinstance(p, bool):
+ if p:
+ return {"disable": True}
+ return {}
return p
def permission(self):
diff --git a/cmk_base/notify.py b/cmk_base/notify.py
index db5a129..2ae135f 100755
--- a/cmk_base/notify.py
+++ b/cmk_base/notify.py
@@ -123,7 +123,6 @@ $LONGSERVICEOUTPUT$
def _transform_user_disable_notifications_opts(contact):
if "disable_notifications" in contact and
isinstance(contact["disable_notifications"], bool):
return {"disable": contact["disable_notifications"]}
-
return contact.get("disable_notifications", {})