[icinga-checkins] icinga.org: icinga2/master: Fix missing persistent_comment, notify_contact columns for acknowledgement table

git at icinga.org git at icinga.org
Sat Feb 7 23:24:54 CET 2015


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

Author: Michael Friedrich <michael.friedrich at gmail.com>
Date:   Sat Feb  7 23:24:16 2015 +0100

Fix missing persistent_comment, notify_contact columns for acknowledgement table

fixes #7871
refs #8298

---

 lib/db_ido/dbevents.cpp |    6 ++++--
 lib/db_ido/dbevents.hpp |    2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/db_ido/dbevents.cpp b/lib/db_ido/dbevents.cpp
index dc89ef1..3dc6c7a 100644
--- a/lib/db_ido/dbevents.cpp
+++ b/lib/db_ido/dbevents.cpp
@@ -66,7 +66,7 @@ void DbEvents::StaticInitialize(void)
 	/* History */
 	Checkable::OnCommentAdded.connect(boost::bind(&DbEvents::AddCommentHistory, _1, _2));
 	Checkable::OnDowntimeAdded.connect(boost::bind(&DbEvents::AddDowntimeHistory, _1, _2));
-	Checkable::OnAcknowledgementSet.connect(boost::bind(&DbEvents::AddAcknowledgementHistory, _1, _2, _3, _4, _5));
+	Checkable::OnAcknowledgementSet.connect(boost::bind(&DbEvents::AddAcknowledgementHistory, _1, _2, _3, _4, _5, _6));
 
 	Checkable::OnNotificationSentToAllUsers.connect(boost::bind(&DbEvents::AddNotificationHistory, _1, _2, _3, _4, _5, _6, _7));
 
@@ -698,7 +698,7 @@ void DbEvents::TriggerDowntime(const Checkable::Ptr& checkable, const Downtime::
 
 /* acknowledgements */
 void DbEvents::AddAcknowledgementHistory(const Checkable::Ptr& checkable, const String& author, const String& comment,
-    AcknowledgementType type, double expiry)
+    AcknowledgementType type, bool notify, double expiry)
 {
 	Log(LogDebug, "DbEvents")
 	    << "add acknowledgement history for '" << checkable->GetName() << "'";
@@ -725,6 +725,8 @@ void DbEvents::AddAcknowledgementHistory(const Checkable::Ptr& checkable, const
 	fields1->Set("state", service ? static_cast<int>(service->GetState()) : static_cast<int>(host->GetState()));
 	fields1->Set("author_name", author);
 	fields1->Set("comment_data", comment);
+	fields1->Set("persistent_comment", 1); //always persistent
+	fields1->Set("notify_contacts", notify ? 1 : 0);
 	fields1->Set("is_sticky", type == AcknowledgementSticky ? 1 : 0);
 	fields1->Set("end_time", DbValue::FromTimestamp(end_time));
 	fields1->Set("instance_id", 0); /* DbConnection class fills in real ID */
diff --git a/lib/db_ido/dbevents.hpp b/lib/db_ido/dbevents.hpp
index 9dcea92..7db25c5 100644
--- a/lib/db_ido/dbevents.hpp
+++ b/lib/db_ido/dbevents.hpp
@@ -108,7 +108,7 @@ public:
 	static void AddCommentHistory(const Checkable::Ptr& checkable, const Comment::Ptr& comment);
 	static void AddDowntimeHistory(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime);
 	static void AddAcknowledgementHistory(const Checkable::Ptr& checkable, const String& author, const String& comment,
-	    AcknowledgementType type, double expiry);
+	    AcknowledgementType type, bool notify, double expiry);
 
 	/* notification & contactnotification history */
 	static void AddNotificationHistory(const Notification::Ptr& notification, const Checkable::Ptr& checkable,



More information about the icinga-checkins mailing list