mirror of https://github.com/Icinga/icinga2.git
Check satellites Icinga version before relay the execute command message
This commit is contained in:
parent
730075a177
commit
a90068cc78
|
@ -813,6 +813,21 @@ Dictionary::Ptr ApiActions::ExecuteCommand(const ConfigObject::Ptr& object,
|
||||||
if (local) {
|
if (local) {
|
||||||
ClusterEvents::ExecuteCommandAPIHandler(origin, execParams);
|
ClusterEvents::ExecuteCommandAPIHandler(origin, execParams);
|
||||||
} else {
|
} else {
|
||||||
|
/* Check if the child endpoints have Icinga version >= 2.13 */
|
||||||
|
Zone::Ptr localZone = Zone::GetLocalZone();
|
||||||
|
for (const Zone::Ptr& zone : ConfigType::GetObjectsByType<Zone>()) {
|
||||||
|
/* Fetch immediate child zone members */
|
||||||
|
if (zone->GetParent() == localZone) {
|
||||||
|
std::set<Endpoint::Ptr> endpoints = zone->GetEndpoints();
|
||||||
|
|
||||||
|
for (const Endpoint::Ptr& childEndpoint : endpoints) {
|
||||||
|
if (childEndpoint->GetIcingaVersion() < 21300) {
|
||||||
|
return ApiActions::CreateResult(400, "Endpoint '" + childEndpoint->GetName() + "' has version < 2.13.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Dictionary::Ptr execMessage = new Dictionary();
|
Dictionary::Ptr execMessage = new Dictionary();
|
||||||
execMessage->Set("jsonrpc", "2.0");
|
execMessage->Set("jsonrpc", "2.0");
|
||||||
execMessage->Set("method", "event::ExecuteCommand");
|
execMessage->Set("method", "event::ExecuteCommand");
|
||||||
|
|
Loading…
Reference in New Issue