From 1220ad8a2fbb313f7e48ca33e2a5b1a7fa9eda90 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 21 Mar 2022 15:57:49 +0100 Subject: [PATCH] Icinga DB: correct ack comments' is_sticky On ack Icinga first adds a comment, then acks the checkable so the ack event has the comment ID. But due to the yet missing ack the comment was missing is_sticky. That's corrected now. --- lib/icingadb/icingadb-objects.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/icingadb/icingadb-objects.cpp b/lib/icingadb/icingadb-objects.cpp index e2272a63d..cea99ec42 100644 --- a/lib/icingadb/icingadb-objects.cpp +++ b/lib/icingadb/icingadb-objects.cpp @@ -1380,7 +1380,7 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a attributes->Set("entry_type", comment->GetEntryType()); attributes->Set("entry_time", TimestampToMilliseconds(comment->GetEntryTime())); attributes->Set("is_persistent", comment->GetPersistent()); - attributes->Set("is_sticky", comment->GetEntryType() == CommentAcknowledgement && comment->GetCheckable()->GetAcknowledgement() == AcknowledgementSticky); + attributes->Set("is_sticky", comment->GetSticky()); Host::Ptr host; Service::Ptr service; @@ -1985,7 +1985,7 @@ void IcingaDB::SendAddedComment(const Comment::Ptr& comment) "comment", Utility::ValidateUTF8(comment->GetText()), "entry_type", Convert::ToString(comment->GetEntryType()), "is_persistent", Convert::ToString((unsigned short)comment->GetPersistent()), - "is_sticky", Convert::ToString((unsigned short)(comment->GetEntryType() == CommentAcknowledgement && comment->GetCheckable()->GetAcknowledgement() == AcknowledgementSticky)), + "is_sticky", Convert::ToString((unsigned short)comment->GetSticky()), "event_id", CalcEventID("comment_add", comment), "event_type", "comment_add" }); @@ -2042,7 +2042,7 @@ void IcingaDB::SendRemovedComment(const Comment::Ptr& comment) "comment", Utility::ValidateUTF8(comment->GetText()), "entry_type", Convert::ToString(comment->GetEntryType()), "is_persistent", Convert::ToString((unsigned short)comment->GetPersistent()), - "is_sticky", Convert::ToString((unsigned short)(comment->GetEntryType() == CommentAcknowledgement && comment->GetCheckable()->GetAcknowledgement() == AcknowledgementSticky)), + "is_sticky", Convert::ToString((unsigned short)comment->GetSticky()), "event_id", CalcEventID("comment_remove", comment), "event_type", "comment_remove" });