mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-26 23:24:09 +02:00
(Un)register dependencies from parent prior to child Checkable
This commit is contained in:
parent
7fbb8f7452
commit
a9bb11b16d
@ -251,16 +251,24 @@ void Dependency::OnAllConfigLoaded()
|
|||||||
// InitChildParentReferences() has to be called before.
|
// InitChildParentReferences() has to be called before.
|
||||||
VERIFY(m_Child && m_Parent);
|
VERIFY(m_Child && m_Parent);
|
||||||
|
|
||||||
m_Child->AddDependency(this);
|
// Icinga DB will implicitly send config updates for the parent Checkable to refresh its affects_children and
|
||||||
|
// affected_children columns when registering the dependency from the child Checkable. So, we need to register
|
||||||
|
// the dependency from the parent Checkable first, otherwise the config update of the parent Checkable will change
|
||||||
|
// nothing at all.
|
||||||
m_Parent->AddReverseDependency(this);
|
m_Parent->AddReverseDependency(this);
|
||||||
|
m_Child->AddDependency(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dependency::Stop(bool runtimeRemoved)
|
void Dependency::Stop(bool runtimeRemoved)
|
||||||
{
|
{
|
||||||
ObjectImpl<Dependency>::Stop(runtimeRemoved);
|
ObjectImpl<Dependency>::Stop(runtimeRemoved);
|
||||||
|
|
||||||
GetChild()->RemoveDependency(this, runtimeRemoved);
|
// Icinga DB will implicitly send config updates for the parent Checkable to refresh its affects_children and
|
||||||
|
// affected_children columns when removing the dependency from the child Checkable. So, we need to remove the
|
||||||
|
// dependency from the parent Checkable first, otherwise the config update of the parent Checkable will change
|
||||||
|
// nothing at all.
|
||||||
GetParent()->RemoveReverseDependency(this);
|
GetParent()->RemoveReverseDependency(this);
|
||||||
|
GetChild()->RemoveDependency(this, runtimeRemoved);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Dependency::IsAvailable(DependencyType dt) const
|
bool Dependency::IsAvailable(DependencyType dt) const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user