mirror of
https://github.com/Icinga/icinga2.git
synced 2026-05-28 04:12:13 -04:00
Checkable: require zone to be set if command_endpoint is set
refs #6666
This commit is contained in:
parent
c4d57afa3d
commit
12f3149eef
1 changed files with 8 additions and 6 deletions
|
|
@ -57,14 +57,16 @@ void Checkable::OnAllConfigLoaded()
|
|||
if (endpoint) {
|
||||
Zone::Ptr checkableZone = static_pointer_cast<Zone>(GetZone());
|
||||
|
||||
if (!checkableZone)
|
||||
checkableZone = Zone::GetLocalZone();
|
||||
if (checkableZone) {
|
||||
Zone::Ptr cmdZone = endpoint->GetZone();
|
||||
|
||||
Zone::Ptr cmdZone = endpoint->GetZone();
|
||||
|
||||
if (checkableZone && cmdZone != checkableZone && cmdZone->GetParent() != checkableZone) {
|
||||
if (cmdZone != checkableZone && cmdZone->GetParent() != checkableZone) {
|
||||
BOOST_THROW_EXCEPTION(ValidationError(this, { "command_endpoint" },
|
||||
"Command endpoint must be in zone '" + checkableZone->GetName() + "' or in a direct child zone thereof."));
|
||||
}
|
||||
} else {
|
||||
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…
Reference in a new issue