mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-28 08:04:14 +02:00
Call Endpoint::GetByName only once
This commit is contained in:
parent
50693d7ea9
commit
da82c17891
@ -588,7 +588,8 @@ Dictionary::Ptr ApiActions::ExecuteCommand(const ConfigObject::Ptr& object,
|
|||||||
);
|
);
|
||||||
|
|
||||||
/* Check if endpoint exists */
|
/* Check if endpoint exists */
|
||||||
if (!Endpoint::GetByName(resolved_endpoint))
|
Endpoint::Ptr endpointPtr = Endpoint::GetByName(resolved_endpoint);
|
||||||
|
if (!endpointPtr)
|
||||||
return ApiActions::CreateResult(404, "Can't find a valid endpoint for '" + resolved_endpoint + "'.");
|
return ApiActions::CreateResult(404, "Can't find a valid endpoint for '" + resolved_endpoint + "'.");
|
||||||
|
|
||||||
/* Get command_type */
|
/* Get command_type */
|
||||||
@ -660,8 +661,7 @@ Dictionary::Ptr ApiActions::ExecuteCommand(const ConfigObject::Ptr& object,
|
|||||||
executions->Set(uuid, pending_execution);
|
executions->Set(uuid, pending_execution);
|
||||||
checkable->SetExecutions(executions);
|
checkable->SetExecutions(executions);
|
||||||
|
|
||||||
Endpoint::Ptr endpointPtr = Endpoint::GetByName(resolved_endpoint);
|
bool local = endpointPtr == Endpoint::GetLocalEndpoint();
|
||||||
bool local = !endpointPtr || endpointPtr == Endpoint::GetLocalEndpoint();
|
|
||||||
if (local) {
|
if (local) {
|
||||||
/* TODO */
|
/* TODO */
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user