[icinga-checkins] icinga.org: icinga2/master: Fix: ClusterEvents:: NotificationSentAllUsersAPIHandler() does not set notified_users

git at icinga.org git at icinga.org
Mon Aug 15 17:26:16 CEST 2016


Module: icinga2
Branch: master
Commit: 17544d7b54b8b995ebba5fe72a80dff1709c8270
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=17544d7b54b8b995ebba5fe72a80dff1709c8270

Author: Michael Friedrich <michael.friedrich at netways.de>
Date:   Mon Aug 15 17:26:01 2016 +0200

Fix: ClusterEvents::NotificationSentAllUsersAPIHandler() does not set notified_users

fixes #12444

---

 lib/icinga/clusterevents.cpp |   11 ++++-------
 lib/icinga/clusterevents.hpp |    2 +-
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/lib/icinga/clusterevents.cpp b/lib/icinga/clusterevents.cpp
index 5f38927..0e5c9d1 100644
--- a/lib/icinga/clusterevents.cpp
+++ b/lib/icinga/clusterevents.cpp
@@ -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);
 
diff --git a/lib/icinga/clusterevents.hpp b/lib/icinga/clusterevents.hpp
index 3b9b7c4..8df2ab8 100644
--- a/lib/icinga/clusterevents.hpp
+++ b/lib/icinga/clusterevents.hpp
@@ -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);
 };



More information about the icinga-checkins mailing list