mirror of https://github.com/Icinga/icinga2.git
parent
e295d76483
commit
309c8d7299
|
@ -65,12 +65,12 @@ void Dependency::OnStateLoaded(void)
|
||||||
ASSERT(!OwnsLock());
|
ASSERT(!OwnsLock());
|
||||||
|
|
||||||
if (!GetChild())
|
if (!GetChild())
|
||||||
Log(LogWarning, "icinga", "Dependency '" + GetName() + "' references an invalid child service and will be ignored.");
|
Log(LogWarning, "icinga", "Dependency '" + GetName() + "' references an invalid child object and will be ignored.");
|
||||||
else
|
else
|
||||||
GetChild()->AddDependency(GetSelf());
|
GetChild()->AddDependency(GetSelf());
|
||||||
|
|
||||||
if (!GetParent())
|
if (!GetParent())
|
||||||
Log(LogWarning, "icinga", "Dependency '" + GetName() + "' references an invalid parent service and will always fail.");
|
Log(LogWarning, "icinga", "Dependency '" + GetName() + "' references an invalid parent object and will always fail.");
|
||||||
else
|
else
|
||||||
GetParent()->AddReverseDependency(GetSelf());
|
GetParent()->AddReverseDependency(GetSelf());
|
||||||
}
|
}
|
||||||
|
@ -93,28 +93,28 @@ bool Dependency::IsAvailable(DependencyType dt) const
|
||||||
if (!parent)
|
if (!parent)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* ignore if it's the same service */
|
Host::Ptr host;
|
||||||
|
Service::Ptr service;
|
||||||
|
tie(host, service) = GetHostService(parent);
|
||||||
|
|
||||||
|
/* ignore if it's the same checkable object */
|
||||||
if (parent == GetChild()) {
|
if (parent == GetChild()) {
|
||||||
Log(LogDebug, "icinga", "Dependency '" + GetName() + "' passed: Parent and child service are identical.");
|
Log(LogDebug, "icinga", "Dependency '" + GetName() + "' passed: Parent and child " + (service ? "service" : "host") + " are identical.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ignore pending services */
|
/* ignore pending */
|
||||||
if (!parent->GetLastCheckResult()) {
|
if (!parent->GetLastCheckResult()) {
|
||||||
Log(LogDebug, "icinga", "Dependency '" + GetName() + "' passed: Service hasn't been checked yet.");
|
Log(LogDebug, "icinga", "Dependency '" + GetName() + "' passed: " + (service ? "Service" : "Host") + " '" + parent->GetName() + "' hasn't been checked yet.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ignore soft states */
|
/* ignore soft states */
|
||||||
if (parent->GetStateType() == StateTypeSoft) {
|
if (parent->GetStateType() == StateTypeSoft) {
|
||||||
Log(LogDebug, "icinga", "Dependency '" + GetName() + "' passed: Service is in a soft state.");
|
Log(LogDebug, "icinga", "Dependency '" + GetName() + "' passed: " + (service ? "Service" : "Host") + " '" + parent->GetName() + "' is in a soft state.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Host::Ptr host;
|
|
||||||
Service::Ptr service;
|
|
||||||
tie(host, service) = GetHostService(parent);
|
|
||||||
|
|
||||||
int state;
|
int state;
|
||||||
|
|
||||||
if (service)
|
if (service)
|
||||||
|
@ -124,7 +124,7 @@ bool Dependency::IsAvailable(DependencyType dt) const
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if (state & GetStateFilter()) {
|
if (state & GetStateFilter()) {
|
||||||
Log(LogDebug, "icinga", "Dependency '" + GetName() + "' passed: Object matches state filter.");
|
Log(LogDebug, "icinga", "Dependency '" + GetName() + "' passed: " + (service ? "Service" : "Host") + " '" + parent->GetName() + "' matches state filter.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue