From e9b1573be991d863bd6a7f2e281ec4e111d2a1bb Mon Sep 17 00:00:00 2001 From: Ronny Bruska Date: Fri, 22 Nov 2024 09:29:03 +0100 Subject: [PATCH] 17172 FIX Better log message for notification tests SUP-21533 Change-Id: Ia253753567986ed3db819d86d9fcddda30a489eb --- .werks/17172.md | 20 ++++++++++++++++++++ cmk/base/notify.py | 6 +++++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 .werks/17172.md diff --git a/.werks/17172.md b/.werks/17172.md new file mode 100644 index 00000000000..a842a803716 --- /dev/null +++ b/.werks/17172.md @@ -0,0 +1,20 @@ +[//]: # (werk v2) +# Better log message for notification tests + +key | value +---------- | --- +date | 2024-11-22T08:27:23+00:00 +version | 2.4.0b1 +class | fix +edition | cre +component | notifications +level | 1 +compatible | yes + +If you enabled "Send out HTML/ASCII email notification according to +notification rules" in the "Test notifications" section and a rule with a +plug-in other than "HTML Email" or "ASCII Email" matched, the notify.log showed +something like "notifying USERNAME via ...". + +As you can only send out HTML Email and ASCII Email notifications, the log will +now show "would notify cmkadmin via ...". diff --git a/cmk/base/notify.py b/cmk/base/notify.py index 9608bd6d5d9..6f8c8d5f125 100644 --- a/cmk/base/notify.py +++ b/cmk/base/notify.py @@ -953,7 +953,11 @@ def _process_notifications( # Now do the actual notifications logger.info("Executing %d notifications:", len(notifications)) for (contacts, plugin_name), (_locked, params, bulk) in sorted(notifications.items()): - verb = "would notify" if analyse and not dispatch else "notifying" + verb = ( + "would notify" + if analyse and (not dispatch or plugin_name not in ["mail", "asciimail"]) + else "notifying" + ) contactstxt = ", ".join(contacts) plugintxt = plugin_name # Hack for "Call with the following..." find a better solution