mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-28 16:14:09 +02:00
Merge pull request #6853 from Icinga/bugfix/incorrect-command_endpoint-6666
Checkable: require zone to be set if command_endpoint is set
This commit is contained in:
commit
5a8729fddd
@ -57,14 +57,16 @@ void Checkable::OnAllConfigLoaded()
|
|||||||
if (endpoint) {
|
if (endpoint) {
|
||||||
Zone::Ptr checkableZone = static_pointer_cast<Zone>(GetZone());
|
Zone::Ptr checkableZone = static_pointer_cast<Zone>(GetZone());
|
||||||
|
|
||||||
if (!checkableZone)
|
if (checkableZone) {
|
||||||
checkableZone = Zone::GetLocalZone();
|
Zone::Ptr cmdZone = endpoint->GetZone();
|
||||||
|
|
||||||
Zone::Ptr cmdZone = endpoint->GetZone();
|
if (cmdZone != checkableZone && cmdZone->GetParent() != checkableZone) {
|
||||||
|
BOOST_THROW_EXCEPTION(ValidationError(this, { "command_endpoint" },
|
||||||
if (checkableZone && cmdZone != checkableZone && cmdZone->GetParent() != checkableZone) {
|
"Command endpoint must be in zone '" + checkableZone->GetName() + "' or in a direct child zone thereof."));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
BOOST_THROW_EXCEPTION(ValidationError(this, { "command_endpoint" },
|
BOOST_THROW_EXCEPTION(ValidationError(this, { "command_endpoint" },
|
||||||
"Command endpoint must be in zone '" + checkableZone->GetName() + "' or in a direct child zone thereof."));
|
"Command endpoint must not be set."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user