Checkable: require zone to be set if command_endpoint is set

refs #6666
This commit is contained in:
Alexander A. Klimov 2018-12-20 13:59:28 +01:00
parent c4d57afa3d
commit 12f3149eef
1 changed files with 8 additions and 6 deletions

View File

@ -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."));
}
}
}