]> granicus.if.org Git - icinga2/commitdiff
Fix: ClusterEvents::NotificationSentAllUsersAPIHandler() does not set notified_users
authorMichael Friedrich <michael.friedrich@netways.de>
Mon, 15 Aug 2016 15:26:01 +0000 (17:26 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Mon, 15 Aug 2016 15:26:01 +0000 (17:26 +0200)
fixes #12444

lib/icinga/clusterevents.cpp
lib/icinga/clusterevents.hpp

index 5f38927061ec76b741eb8e4a3a8b40e94766ee59..0e5c9d17911369a66c2cf3363761543280f11f3f 100644 (file)
@@ -63,7 +63,7 @@ void ClusterEvents::StaticInitialize(void)
        Checkable::OnForceNextNotificationChanged.connect(&ClusterEvents::ForceNextNotificationChangedHandler);
        Checkable::OnNotificationsRequested.connect(&ClusterEvents::SendNotificationsHandler);
        Checkable::OnNotificationSentToUser.connect(&ClusterEvents::NotificationSentUserHandler);
-       Checkable::OnNotificationSentToAllUsers.connect(&ClusterEvents::NotificationSentAllUsersHandler);
+       Checkable::OnNotificationSentToAllUsers.connect(&ClusterEvents::NotificationSentToAllUsersHandler);
 
        Checkable::OnAcknowledgementSet.connect(&ClusterEvents::AcknowledgementSetHandler);
        Checkable::OnAcknowledgementCleared.connect(&ClusterEvents::AcknowledgementClearedHandler);
@@ -939,7 +939,7 @@ Value ClusterEvents::NotificationSentUserAPIHandler(const MessageOrigin::Ptr& or
        return Empty;
 }
 
-void ClusterEvents::NotificationSentAllUsersHandler(const Notification::Ptr& notification, const Checkable::Ptr& checkable, const std::set<User::Ptr>& users,
+void ClusterEvents::NotificationSentToAllUsersHandler(const Notification::Ptr& notification, const Checkable::Ptr& checkable, const std::set<User::Ptr>& users,
     NotificationType notificationType, const CheckResult::Ptr& cr, const String& author, const String& commentText, const MessageOrigin::Ptr& origin)
 {
        ApiListener::Ptr listener = ApiListener::GetInstance();
@@ -957,11 +957,7 @@ void ClusterEvents::NotificationSentAllUsersHandler(const Notification::Ptr& not
                params->Set("service", service->GetShortName());
        params->Set("notification", notification->GetName());
 
-       Array::Ptr ausers = new Array();
-       BOOST_FOREACH(const User::Ptr& user, users) {
-               ausers->Add(user->GetName());
-       }
-       params->Set("users", ausers);
+       params->Set("users", Array::FromSet(users));
 
        params->Set("type", notificationType);
        params->Set("cr", Serialize(cr));
@@ -1055,6 +1051,7 @@ Value ClusterEvents::NotificationSentAllUsersAPIHandler(const MessageOrigin::Ptr
        notification->SetNextNotification(params->Get("next_notification"));
        notification->SetNotificationNumber(params->Get("notification_number"));
        notification->SetLastProblemNotification(params->Get("last_problem_notification"));
+       notification->SetNotifiedUsers(Array::FromSet(users));
 
        Checkable::OnNotificationSentToAllUsers(notification, checkable, users, type, cr, author, text, origin);
 
index 3b9b7c4be286e7af690f8e5beb5d99cd9e4d7a60..8df2ab819055eea052705da5388da94c25c55e60 100644 (file)
@@ -75,7 +75,7 @@ public:
            NotificationType notificationType, const CheckResult::Ptr& cr, const String& author, const String& commentText, const String& command, const MessageOrigin::Ptr& origin);
        static Value NotificationSentUserAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
 
-       static void NotificationSentAllUsersHandler(const Notification::Ptr& notification, const Checkable::Ptr& checkable, const std::set<User::Ptr>& users,
+       static void NotificationSentToAllUsersHandler(const Notification::Ptr& notification, const Checkable::Ptr& checkable, const std::set<User::Ptr>& users,
            NotificationType notificationType, const CheckResult::Ptr& cr, const String& author, const String& commentText, const MessageOrigin::Ptr& origin);
        static Value NotificationSentAllUsersAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
 };