From 45e24e47299fd40fa0438a44afc332a7e047c4c0 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 19 Mar 2013 14:13:58 +0100 Subject: [PATCH] Fix Expression::Extract. --- lib/config/expression.cpp | 11 ++++++----- lib/icinga/service-check.cpp | 5 +++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/config/expression.cpp b/lib/config/expression.cpp index 3a240a770..93471cca2 100644 --- a/lib/config/expression.cpp +++ b/lib/config/expression.cpp @@ -220,16 +220,17 @@ void Expression::Extract(const std::vector& path, const ExpressionList:: ASSERT(!path.empty()); if (path[0] == m_Key) { + if (!m_Value.IsObjectType()) + BOOST_THROW_EXCEPTION(std::invalid_argument("Specified path does not exist.")); + + ExpressionList::Ptr exprl = m_Value; + if (path.size() == 1) { - result->AddExpression(*this); + result->AddExpression(Expression("", OperatorExecute, exprl, m_DebugInfo)); return; } - if (!m_Value.IsObjectType()) - BOOST_THROW_EXCEPTION(std::invalid_argument("Specified path does not exist.")); - - ExpressionList::Ptr exprl = m_Value; std::vector sub_path(path.begin() + 1, path.end()); exprl->Extract(sub_path, result); } else if (m_Operator == OperatorExecute) { diff --git a/lib/icinga/service-check.cpp b/lib/icinga/service-check.cpp index 76c02bb77..64603cef8 100644 --- a/lib/icinga/service-check.cpp +++ b/lib/icinga/service-check.cpp @@ -643,6 +643,8 @@ void Service::BeginExecuteCheck(const boost::function& callback) { ASSERT(!OwnsLock()); + bool reachable = IsReachable(); + { ObjectLock olock(this); @@ -660,10 +662,9 @@ void Service::BeginExecuteCheck(const boost::function& callback) SetLastState(GetState()); SetLastStateType(GetLastStateType()); + SetLastReachable(reachable); } - SetLastReachable(IsReachable()); - /* keep track of scheduling info in case the check type doesn't provide its own information */ Dictionary::Ptr checkInfo = boost::make_shared(); checkInfo->Set("schedule_start", GetNextCheck()); -- 2.40.0