From 6a5deaf7d4d4e53e6f9e5af7e11dc5d2180cfe55 Mon Sep 17 00:00:00 2001 From: Mattia Codato Date: Fri, 3 Jul 2020 16:36:58 +0200 Subject: [PATCH] Fix update executions. Fix code indentation --- lib/icinga/clusterevents.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/lib/icinga/clusterevents.cpp b/lib/icinga/clusterevents.cpp index 4dc6f8bc8..5c65d5720 100644 --- a/lib/icinga/clusterevents.cpp +++ b/lib/icinga/clusterevents.cpp @@ -952,8 +952,8 @@ Value ClusterEvents::UpdateExecutionsAPIHandler(const MessageOrigin::Ptr& origin Endpoint::Ptr endpoint = origin->FromClient->GetEndpoint(); if (!endpoint) { Log(LogNotice, "ClusterEvents") - << "Discarding 'update executions API handler' message from '" << origin->FromClient->GetIdentity() - << "': Invalid endpoint origin (client not allowed)."; + << "Discarding 'update executions API handler' message from '" << origin->FromClient->GetIdentity() + << "': Invalid endpoint origin (client not allowed)."; return Empty; } @@ -976,19 +976,14 @@ Value ClusterEvents::UpdateExecutionsAPIHandler(const MessageOrigin::Ptr& origin if (origin->FromZone && !origin->FromZone->CanAccessObject(checkable)) { Log(LogNotice, "ClusterEvents") - << "Discarding 'update executions API handler' message for checkable '" << checkable->GetName() - << "' from '" << origin->FromClient->GetIdentity() << "': Unauthorized access."; + << "Discarding 'update executions API handler' message for checkable '" << checkable->GetName() + << "' from '" << origin->FromClient->GetIdentity() << "': Unauthorized access."; return Empty; } - if (!params->Contains("executions")) { - Log(LogNotice, "ClusterEvents") - << "Discarding 'update executions API handler' message for checkable '" << checkable->GetName() - << "' from '" << origin->FromClient->GetIdentity() << "': missing executions."; - return Empty; - } - - Dictionary::Ptr executions = params->Get("executions"); + Dictionary::Ptr executions = checkable->GetExecutions(); + Dictionary::Ptr newExecutions = params->Get("executions"); + newExecutions->CopyTo(executions); checkable->SetExecutions(executions); return Empty;