From: Gunnar Beutner Date: Thu, 29 Aug 2013 12:01:40 +0000 (+0200) Subject: cluster: Fix duplicate acknowledgement comments. X-Git-Tag: v0.0.3~659 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f33438511101ae038ae53f397e5c6529ad2b8275;p=icinga2 cluster: Fix duplicate acknowledgement comments. --- diff --git a/lib/icinga/externalcommandprocessor.cpp b/lib/icinga/externalcommandprocessor.cpp index 99de51bdc..876cb2aaf 100644 --- a/lib/icinga/externalcommandprocessor.cpp +++ b/lib/icinga/externalcommandprocessor.cpp @@ -508,6 +508,7 @@ void ExternalCommandProcessor::AcknowledgeSvcProblem(double, const std::vectorGetName() + "'"); + service->AddComment(CommentAcknowledgement, arguments[5], arguments[6], 0); service->AcknowledgeProblem(arguments[5], arguments[6], sticky ? AcknowledgementSticky : AcknowledgementNormal); } @@ -526,6 +527,7 @@ void ExternalCommandProcessor::AcknowledgeSvcProblemExpire(double, const std::ve Log(LogInformation, "icinga", "Setting timed acknowledgement for service '" + service->GetName() + "'"); + service->AddComment(CommentAcknowledgement, arguments[6], arguments[7], 0); service->AcknowledgeProblem(arguments[6], arguments[7], sticky ? AcknowledgementSticky : AcknowledgementNormal, timestamp); } @@ -556,6 +558,7 @@ void ExternalCommandProcessor::AcknowledgeHostProblem(double, const std::vector< if (service->GetState() == StateOK) BOOST_THROW_EXCEPTION(std::invalid_argument("The host '" + arguments[0] + "' is OK.")); + service->AddComment(CommentAcknowledgement, arguments[4], arguments[5], 0); service->AcknowledgeProblem(arguments[4], arguments[5], sticky ? AcknowledgementSticky : AcknowledgementNormal); } } @@ -576,6 +579,7 @@ void ExternalCommandProcessor::AcknowledgeHostProblemExpire(double, const std::v if (service->GetState() == StateOK) BOOST_THROW_EXCEPTION(std::invalid_argument("The host '" + arguments[0] + "' is OK.")); + service->AddComment(CommentAcknowledgement, arguments[5], arguments[6], 0); service->AcknowledgeProblem(arguments[5], arguments[6], sticky ? AcknowledgementSticky : AcknowledgementNormal, timestamp); } } diff --git a/lib/icinga/service.cpp b/lib/icinga/service.cpp index ff874b0c2..75c195bf5 100644 --- a/lib/icinga/service.cpp +++ b/lib/icinga/service.cpp @@ -242,8 +242,6 @@ void Service::AcknowledgeProblem(const String& author, const String& comment, Ac m_AcknowledgementExpiry = expiry; } - (void) AddComment(CommentAcknowledgement, author, comment, 0); - OnNotificationsRequested(GetSelf(), NotificationAcknowledgement, GetLastCheckResult(), author, comment); Utility::QueueAsyncCallback(bind(boost::ref(OnAcknowledgementSet), GetSelf(), author, comment, type, expiry, authority));