From db6c89bc58c30af7dbeb4d50e010c06f11556793 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Thu, 24 Jan 2013 10:40:31 +0100 Subject: [PATCH] Update service state when delegation is unsuccessful Fixes #3548 --- components/delegation/delegationcomponent.cpp | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/components/delegation/delegationcomponent.cpp b/components/delegation/delegationcomponent.cpp index 7dff383d2..d7937ece4 100644 --- a/components/delegation/delegationcomponent.cpp +++ b/components/delegation/delegationcomponent.cpp @@ -163,7 +163,28 @@ void DelegationComponent::DelegationTimerHandler(void) break; } - assert(candidates.size() == 0 || !service->GetChecker().IsEmpty()); + if (candidates.size() == 0) { + if (service->GetState() != StateUncheckable && service->GetEnableChecks()) { + Dictionary::Ptr cr = boost::make_shared(); + + double now = Utility::GetTime(); + cr->Set("schedule_start", now); + cr->Set("schedule_end", now); + cr->Set("execution_start", now); + cr->Set("execution_end", now); + + cr->Set("state", StateUncheckable); + cr->Set("output", "No checker is available for this service."); + + service->ProcessCheckResult(cr); + + Logger::Write(LogWarning, "delegation", "Can't delegate service: " + service->GetName()); + } + + continue; + } + + assert(!service->GetChecker().IsEmpty()); } Endpoint::Ptr endpoint; -- 2.40.0