Module: check_mk
Branch: master
Commit: 5c0b9f7eecb78b90a4457ebcdd9a7a69b5bcc70d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5c0b9f7eecb78b…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Sep 26 17:07:45 2018 +0200
6720 FIX Bulk mail notifications: Single notifications in bulks use non-bulk subject
All 1.5 releases were always using the bulk notification subjects for mails.
Previous versions were using the single notification subject in case a bulk
notification only contained a single notification. This has been changed back
to the original behaviour.
Change-Id: I9c4e16b024e0b0124bdc510582cb0de3a2fa24fe
---
.werks/6720 | 14 ++++++++++++++
cmk/notification_plugins/asciimail.py | 5 ++++-
cmk/notification_plugins/mail.py | 5 ++++-
3 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/.werks/6720 b/.werks/6720
new file mode 100644
index 0000000..051b61d
--- /dev/null
+++ b/.werks/6720
@@ -0,0 +1,14 @@
+Title: Bulk mail notifications: Single notifications in bulks use non-bulk subject
+Level: 1
+Component: notifications
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1537967537
+
+All 1.5 releases were always using the bulk notification subjects for mails.
+Previous versions were using the single notification subject in case a bulk
+notification only contained a single notification. This has been changed back
+to the original behaviour.
diff --git a/cmk/notification_plugins/asciimail.py
b/cmk/notification_plugins/asciimail.py
index 3826661..0483056 100644
--- a/cmk/notification_plugins/asciimail.py
+++ b/cmk/notification_plugins/asciimail.py
@@ -152,7 +152,10 @@ def main():
mailto = context['CONTACTEMAIL'] # Assume the same in each context
subject = context['SUBJECT']
hosts.add(context["HOSTNAME"])
- subject = utils.get_bulk_notification_subject(contexts, hosts)
+
+ # Use the single context subject in case there is only one context in the bulk
+ if len(contexts) > 1:
+ subject = utils.get_bulk_notification_subject(contexts, hosts)
else:
# gather all options from env
diff --git a/cmk/notification_plugins/mail.py b/cmk/notification_plugins/mail.py
index f55892a..3a6882f 100644
--- a/cmk/notification_plugins/mail.py
+++ b/cmk/notification_plugins/mail.py
@@ -933,7 +933,10 @@ def main():
mailto = context['CONTACTEMAIL'] # Assume the same in each context
subject = context['SUBJECT']
hosts.add(context["HOSTNAME"])
- subject = utils.get_bulk_notification_subject(contexts, hosts)
+
+ # Use the single context subject in case there is only one context in the bulk
+ if len(contexts) > 1:
+ subject = utils.get_bulk_notification_subject(contexts, hosts)
else:
# gather all options from env