MCPcopy Create free account
hub / github.com/Icinga/icinga2 / OnAllConfigLoaded

Method OnAllConfigLoaded

lib/icinga/service.cpp:42–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42void Service::OnAllConfigLoaded()
43{
44 ObjectImpl<Service>::OnAllConfigLoaded();
45
46 String zoneName = GetZoneName();
47
48 if (!zoneName.IsEmpty()) {
49 Zone::Ptr zone = Zone::GetByName(zoneName);
50
51 if (zone && zone->IsGlobal())
52 BOOST_THROW_EXCEPTION(std::invalid_argument("Service '" + GetName() + "' cannot be put into global zone '" + zone->GetName() + "'."));
53 }
54
55 m_Host = Host::GetByName(GetHostName());
56
57 if (m_Host)
58 m_Host->AddService(this);
59
60 ServiceGroup::EvaluateObjectRules(this);
61
62 Array::Ptr groups = GetGroups();
63
64 if (groups) {
65 groups = groups->ShallowClone();
66
67 ObjectLock olock(groups);
68
69 for (String name : groups) {
70 ServiceGroup::Ptr sg = ServiceGroup::GetByName(name);
71
72 if (sg)
73 sg->ResolveGroupMembership(this, true);
74 }
75 }
76}
77
78void Service::CreateChildObjects(const Type::Ptr& childType)
79{

Callers

nothing calls this directly

Calls 6

IsGlobalMethod · 0.80
AddServiceMethod · 0.80
IsEmptyMethod · 0.45
GetNameMethod · 0.45
ShallowCloneMethod · 0.45

Tested by

no test coverage detected