mirror of https://github.com/Icinga/icinga2.git
Check if the node accept commands only if the origin is not local
This commit is contained in:
parent
05b1beb2ff
commit
b4d6fe2c8d
|
@ -154,7 +154,7 @@ void ClusterEvents::ExecuteCheckFromQueue(const MessageOrigin::Ptr& origin, cons
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!listener->GetAcceptCommands()) {
|
if (!listener->GetAcceptCommands() && !origin->IsLocal()) {
|
||||||
Log(LogWarning, "ApiListener")
|
Log(LogWarning, "ApiListener")
|
||||||
<< "Ignoring command. '" << listener->GetName() << "' does not accept commands.";
|
<< "Ignoring command. '" << listener->GetName() << "' does not accept commands.";
|
||||||
|
|
||||||
|
@ -172,16 +172,12 @@ void ClusterEvents::ExecuteCheckFromQueue(const MessageOrigin::Ptr& origin, cons
|
||||||
executedParams->Set("start", now);
|
executedParams->Set("start", now);
|
||||||
executedParams->Set("end", now);
|
executedParams->Set("end", now);
|
||||||
|
|
||||||
if (origin->IsLocal()) {
|
|
||||||
ClusterEvents::ExecutedCommandAPIHandler(origin, executedParams);
|
|
||||||
} else {
|
|
||||||
Dictionary::Ptr executedMessage = new Dictionary();
|
Dictionary::Ptr executedMessage = new Dictionary();
|
||||||
executedMessage->Set("jsonrpc", "2.0");
|
executedMessage->Set("jsonrpc", "2.0");
|
||||||
executedMessage->Set("method", "event::ExecutedCommand");
|
executedMessage->Set("method", "event::ExecutedCommand");
|
||||||
executedMessage->Set("params", executedParams);
|
executedMessage->Set("params", executedParams);
|
||||||
|
|
||||||
listener->SyncSendMessage(sourceEndpoint, executedMessage);
|
listener->SyncSendMessage(sourceEndpoint, executedMessage);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
Host::Ptr host = new Host();
|
Host::Ptr host = new Host();
|
||||||
Dictionary::Ptr attrs = new Dictionary();
|
Dictionary::Ptr attrs = new Dictionary();
|
||||||
|
|
Loading…
Reference in New Issue