mirror of https://github.com/Icinga/icinga2.git
Raise a config error for "Checkable" objects in global zones
fixes #10807
This commit is contained in:
parent
e69fe8dcd0
commit
f5fda9ebf0
|
@ -38,6 +38,15 @@ void Host::OnAllConfigLoaded(void)
|
||||||
{
|
{
|
||||||
ObjectImpl<Host>::OnAllConfigLoaded();
|
ObjectImpl<Host>::OnAllConfigLoaded();
|
||||||
|
|
||||||
|
String zoneName = GetZoneName();
|
||||||
|
|
||||||
|
if (!zoneName.IsEmpty()) {
|
||||||
|
Zone::Ptr zone = Zone::GetByName(zoneName);
|
||||||
|
|
||||||
|
if (zone && zone->IsGlobal())
|
||||||
|
BOOST_THROW_EXCEPTION(std::invalid_argument("Host '" + GetName() + "' cannot be put into global zone '" + zone->GetName() + "'."));
|
||||||
|
}
|
||||||
|
|
||||||
HostGroup::EvaluateObjectRules(this);
|
HostGroup::EvaluateObjectRules(this);
|
||||||
|
|
||||||
Array::Ptr groups = GetGroups();
|
Array::Ptr groups = GetGroups();
|
||||||
|
|
|
@ -63,6 +63,15 @@ void Service::OnAllConfigLoaded(void)
|
||||||
{
|
{
|
||||||
ObjectImpl<Service>::OnAllConfigLoaded();
|
ObjectImpl<Service>::OnAllConfigLoaded();
|
||||||
|
|
||||||
|
String zoneName = GetZoneName();
|
||||||
|
|
||||||
|
if (!zoneName.IsEmpty()) {
|
||||||
|
Zone::Ptr zone = Zone::GetByName(zoneName);
|
||||||
|
|
||||||
|
if (zone && zone->IsGlobal())
|
||||||
|
BOOST_THROW_EXCEPTION(std::invalid_argument("Service '" + GetName() + "' cannot be put into global zone '" + zone->GetName() + "'."));
|
||||||
|
}
|
||||||
|
|
||||||
m_Host = Host::GetByName(GetHostName());
|
m_Host = Host::GetByName(GetHostName());
|
||||||
|
|
||||||
if (m_Host)
|
if (m_Host)
|
||||||
|
|
Loading…
Reference in New Issue