From 4ea65076b0434d840d8eca09d77ff18bf348ccfc Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Tue, 25 Jan 2022 11:38:05 +0100 Subject: [PATCH] Checkable#ProcessCheckResult(): call Checkable::OnReachabilityChanged last to ensure Checkable#IsReachable() returns correctly for dependency children inside OnReachabilityChanged(). That needs the dependency parent to be already in the correct state. refs #9143 --- lib/icinga/checkable-check.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/icinga/checkable-check.cpp b/lib/icinga/checkable-check.cpp index 9dccd5c27..73e28830e 100644 --- a/lib/icinga/checkable-check.cpp +++ b/lib/icinga/checkable-check.cpp @@ -215,10 +215,6 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig ResetNotificationNumbers(); SaveLastState(ServiceOK, cr->GetExecutionEnd()); - - /* update reachability for child objects in OK state */ - if (!children.empty()) - OnReachabilityChanged(this, cr, children, origin); } else { /* OK -> NOT-OK change, first SOFT state. Reset attempt counter. */ if (IsStateOK(old_state)) { @@ -241,10 +237,6 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig if (!IsStateOK(cr->GetState())) { SaveLastState(cr->GetState(), cr->GetExecutionEnd()); } - - /* update reachability for child objects in NOT-OK state */ - if (!children.empty()) - OnReachabilityChanged(this, cr, children, origin); } if (recovery) { @@ -514,6 +506,10 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig SetSuppressedNotifications(suppressed_types_after); } } + + /* update reachability for child objects */ + if (!children.empty()) + OnReachabilityChanged(this, cr, children, origin); } void Checkable::ExecuteRemoteCheck(const Dictionary::Ptr& resolvedMacros)