]> granicus.if.org Git - icinga2/commitdiff
Fix permissions for agent CheckResult messages
authorGunnar Beutner <gunnar@beutner.name>
Mon, 30 Mar 2015 11:39:24 +0000 (13:39 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Mon, 30 Mar 2015 11:50:40 +0000 (13:50 +0200)
fixes #8821

lib/icinga/apievents.cpp
lib/icinga/checkable-check.cpp

index be235d38f6de02351e2025818f6992ccf6651a25..9e898cae483a77c9996f83cbacb964455bcdb704 100644 (file)
@@ -193,7 +193,10 @@ Value ApiEvents::CheckResultAPIHandler(const MessageOrigin& origin, const Dictio
        if (origin.FromZone && !origin.FromZone->CanAccessObject(checkable) && endpoint != checkable->GetCommandEndpoint())
                return Empty;
 
-       checkable->ProcessCheckResult(cr, origin);
+       if (endpoint == checkable->GetCommandEndpoint())
+               checkable->ProcessCheckResult(cr);
+       else
+               checkable->ProcessCheckResult(cr, origin);
 
        return Empty;
 }
index a4da0c31dadfd7f96a21987634bb94f079f75b42..bc4cacd12c4e24ca237842b98ad07686dcb9ff83 100644 (file)
@@ -268,25 +268,6 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
                        /* send message back to its origin */
                        Dictionary::Ptr message = ApiEvents::MakeCheckResultMessage(this, cr);
                        listener->SyncSendMessage(command_endpoint, message);
-
-                       /* HA cluster zone nodes must also process the check result locally
-                        * by fetching the real host/service object if existing
-                        */
-                       Host::Ptr tempHost;
-                       Service::Ptr tempService;
-                       tie(tempHost, tempService) = GetHostService(this);
-                       Host::Ptr realHost = Host::GetByName(tempHost->GetName());
-                       if (realHost) {
-                               Value agent_service_name = GetExtension("agent_service_name");
-                               if (!agent_service_name.IsEmpty()) {
-                                       Checkable::Ptr realCheckable;
-                                       realCheckable = realHost->GetServiceByShortName(agent_service_name);
-                                       if (realCheckable) {
-                                               realCheckable->ProcessCheckResult(cr, origin);
-                                       }
-                               }
-                       }
-
                }
 
                return;