[icinga-checkins] icinga.org: icinga2/fix/validation-no-comment-downtime-delete-11890: DB IDO: Ensure to delete outdated comments/downtimes for host/ service objects

git at icinga.org git at icinga.org
Fri Jun 3 14:42:37 CEST 2016


Module: icinga2
Branch: fix/validation-no-comment-downtime-delete-11890
Commit: 0ce41399e0b0c2e5de489a9f3c4b9b608e682952
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=0ce41399e0b0c2e5de489a9f3c4b9b608e682952

Author: Michael Friedrich <michael.friedrich at netways.de>
Date:   Fri Jun  3 14:40:37 2016 +0200

DB IDO: Ensure to delete outdated comments/downtimes for host/service objects

fixes #11688

---

 lib/db_ido/dbevents.cpp |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/db_ido/dbevents.cpp b/lib/db_ido/dbevents.cpp
index b9b3796..b19bfad 100644
--- a/lib/db_ido/dbevents.cpp
+++ b/lib/db_ido/dbevents.cpp
@@ -303,11 +303,11 @@ void DbEvents::AddComments(const Checkable::Ptr& checkable)
 {
 	std::set<Comment::Ptr> comments = checkable->GetComments();
 
-	if (comments.empty())
-		return;
-
 	std::vector<DbQuery> queries;
 
+	/* Ensure to delete all comments and then insert any or none.
+	 * We must purge obsolete comments in the database at all cost. */
+
 	DbQuery query1;
 	query1.Table = "comments";
 	query1.Type = DbQueryDelete;
@@ -442,8 +442,8 @@ void DbEvents::AddDowntimes(const Checkable::Ptr& checkable)
 {
 	std::set<Downtime::Ptr> downtimes = checkable->GetDowntimes();
 
-	if (downtimes.empty())
-		return;
+	/* Ensure to delete all downtimes and then insert any or none.
+	 * We must purge obsolete downtimes in the database at all cost. */
 
 	std::vector<DbQuery> queries;
 



More information about the icinga-checkins mailing list