From: Michael Friedrich Date: Wed, 3 Apr 2019 11:50:21 +0000 (+0200) Subject: Fix notification skip for local non-API enabled setups X-Git-Tag: v2.11.0-rc1~167^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=84019ba27a83706044ef62c0f102cc5709d7e9b3;p=icinga2 Fix notification skip for local non-API enabled setups W/o local endpoint, these reminder notifications would have been skipped otherwise. PR #6935 improved the logging and made this problem visible. Thanks @nilmerg :) --- diff --git a/lib/notification/notificationcomponent.cpp b/lib/notification/notificationcomponent.cpp index 57ef3011d..36fe8ecaa 100644 --- a/lib/notification/notificationcomponent.cpp +++ b/lib/notification/notificationcomponent.cpp @@ -64,13 +64,17 @@ void NotificationComponent::NotificationTimerHandler() { double now = Utility::GetTime(); + /* Function already checks whether 'api' feature is enabled. */ + Endpoint::Ptr myEndpoint = Endpoint::GetLocalEndpoint(); + for (const Notification::Ptr& notification : ConfigType::GetObjectsByType()) { if (!notification->IsActive()) continue; String notificationName = notification->GetName(); - if (notification->IsPaused() && GetEnableHA()) { + /* Skip notification if paused, in a cluster setup & HA feature is enabled. */ + if (notification->IsPaused() && myEndpoint && GetEnableHA()) { Log(LogNotice, "NotificationComponent") << "Reminder notification '" << notificationName << "': HA cluster active, this endpoint does not have the authority (paused=true). Skipping."; continue;