mirror of
https://github.com/Icinga/icinga2.git
synced 2025-09-23 17:57:54 +02:00
parent
832b5bed2a
commit
81974adf65
@ -39,24 +39,18 @@ void Endpoint::OnAllConfigLoaded(void)
|
|||||||
{
|
{
|
||||||
ObjectImpl<Endpoint>::OnAllConfigLoaded();
|
ObjectImpl<Endpoint>::OnAllConfigLoaded();
|
||||||
|
|
||||||
BOOST_FOREACH(const Zone::Ptr& zone, ConfigType::GetObjectsByType<Zone>()) {
|
if (!m_Zone)
|
||||||
const std::set<Endpoint::Ptr> members = zone->GetEndpoints();
|
BOOST_THROW_EXCEPTION(ScriptError("Endpoint '" + GetName() +
|
||||||
|
"' does not belong to a zone.", GetDebugInfo()));
|
||||||
|
}
|
||||||
|
|
||||||
if (members.empty())
|
void Endpoint::SetCachedZone(const Zone::Ptr& zone)
|
||||||
continue;
|
{
|
||||||
|
|
||||||
if (members.find(this) != members.end()) {
|
|
||||||
if (m_Zone)
|
if (m_Zone)
|
||||||
BOOST_THROW_EXCEPTION(ScriptError("Endpoint '" + GetName()
|
BOOST_THROW_EXCEPTION(ScriptError("Endpoint '" + GetName()
|
||||||
+ "' is in more than one zone.", GetDebugInfo()));
|
+ "' is in more than one zone.", GetDebugInfo()));
|
||||||
|
|
||||||
m_Zone = zone;
|
m_Zone = zone;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_Zone)
|
|
||||||
BOOST_THROW_EXCEPTION(ScriptError("Endpoint '" + GetName() +
|
|
||||||
"' does not belong to a zone.", GetDebugInfo()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Endpoint::AddClient(const JsonRpcConnection::Ptr& client)
|
void Endpoint::AddClient(const JsonRpcConnection::Ptr& client)
|
||||||
|
@ -54,6 +54,8 @@ public:
|
|||||||
|
|
||||||
static Endpoint::Ptr GetLocalEndpoint(void);
|
static Endpoint::Ptr GetLocalEndpoint(void);
|
||||||
|
|
||||||
|
void SetCachedZone(const intrusive_ptr<Zone>& zone);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void OnAllConfigLoaded(void) override;
|
virtual void OnAllConfigLoaded(void) override;
|
||||||
|
|
||||||
|
@ -26,6 +26,8 @@ namespace icinga
|
|||||||
|
|
||||||
class Endpoint : ConfigObject
|
class Endpoint : ConfigObject
|
||||||
{
|
{
|
||||||
|
load_after Zone;
|
||||||
|
|
||||||
[config] String host;
|
[config] String host;
|
||||||
[config, required] String port {
|
[config, required] String port {
|
||||||
default {{{ return "5665"; }}}
|
default {{{ return "5665"; }}}
|
||||||
|
@ -37,6 +37,14 @@ void Zone::OnAllConfigLoaded(void)
|
|||||||
Zone::Ptr zone = m_Parent;
|
Zone::Ptr zone = m_Parent;
|
||||||
int levels = 0;
|
int levels = 0;
|
||||||
|
|
||||||
|
Array::Ptr endpoints = GetEndpointsRaw();
|
||||||
|
|
||||||
|
if (endpoints) {
|
||||||
|
BOOST_FOREACH(const String& endpoint, endpoints) {
|
||||||
|
Endpoint::GetByName(endpoint)->SetCachedZone(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while (zone) {
|
while (zone) {
|
||||||
m_AllParents.push_back(zone);
|
m_AllParents.push_back(zone);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user