diff --git a/cib/service.cpp b/cib/service.cpp index 495341068..64e042a42 100644 --- a/cib/service.cpp +++ b/cib/service.cpp @@ -107,6 +107,13 @@ Dictionary::Ptr Service::GetGroups(void) const return value; } +Dictionary::Ptr Service::GetCheckers(void) const +{ + Dictionary::Ptr value; + GetConfigObject()->GetProperty("checkers", &value); + return value; +} + void Service::SetNextCheck(time_t nextCheck) { GetConfigObject()->SetTag("next_check", (long)nextCheck); @@ -302,6 +309,19 @@ string Service::StateTypeToString(ServiceStateType type) bool Service::IsAllowedChecker(const string& checker) const { - /* TODO: check config */ - return true; + Dictionary::Ptr checkers = GetCheckers(); + + if (!checkers) + return true; + + Dictionary::Iterator it; + for (it = checkers->Begin(); it != checkers->End(); it++) { + string pattern = it->second; + + if (Utility::Match(pattern, checker)) + return true; + } + + return false; } + diff --git a/cib/service.h b/cib/service.h index 8e7874348..4f524b686 100644 --- a/cib/service.h +++ b/cib/service.h @@ -43,6 +43,7 @@ public: long GetFreshnessInterval(void) const; Dictionary::Ptr GetDependencies(void) const; Dictionary::Ptr GetGroups(void) const; + Dictionary::Ptr GetCheckers(void) const; void SetNextCheck(time_t nextCheck); time_t GetNextCheck(void); diff --git a/components/compat/compatcomponent.cpp b/components/compat/compatcomponent.cpp index 197edc563..a5bda76c9 100644 --- a/components/compat/compatcomponent.cpp +++ b/components/compat/compatcomponent.cpp @@ -47,6 +47,7 @@ void CompatComponent::Start(void) m_StatusTimer->OnTimerExpired.connect(boost::bind(&CompatComponent::StatusTimerHandler, this)); m_StatusTimer->Start(); + CIB::RequireInformation(CIB_Configuration); CIB::RequireInformation(CIB_ProgramStatus); CIB::RequireInformation(CIB_ServiceStatus); }