mirror of https://github.com/Icinga/icinga2.git
parent
b268e7d32d
commit
e04d200d36
|
@ -75,7 +75,7 @@ bool ApplyRule::EvaluateFilter(const Dictionary::Ptr& scope) const
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplyRule::EvaluateRules(void)
|
void ApplyRule::EvaluateRules(bool clear)
|
||||||
{
|
{
|
||||||
std::set<String> completedTypes;
|
std::set<String> completedTypes;
|
||||||
|
|
||||||
|
@ -113,7 +113,8 @@ void ApplyRule::EvaluateRules(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Rules.clear();
|
if (clear)
|
||||||
|
m_Rules.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplyRule::RegisterType(const String& sourceType, const std::vector<String>& targetTypes, const ApplyRule::Callback& callback)
|
void ApplyRule::RegisterType(const String& sourceType, const std::vector<String>& targetTypes, const ApplyRule::Callback& callback)
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
|
|
||||||
static void AddRule(const String& sourceType, const String& targetType, const String& name, const AExpression::Ptr& expression,
|
static void AddRule(const String& sourceType, const String& targetType, const String& name, const AExpression::Ptr& expression,
|
||||||
const AExpression::Ptr& filter, const DebugInfo& di, const Dictionary::Ptr& scope);
|
const AExpression::Ptr& filter, const DebugInfo& di, const Dictionary::Ptr& scope);
|
||||||
static void EvaluateRules(void);
|
static void EvaluateRules(bool clear);
|
||||||
|
|
||||||
static void RegisterType(const String& sourceType, const std::vector<String>& targetTypes, const ApplyRule::Callback& callback);
|
static void RegisterType(const String& sourceType, const std::vector<String>& targetTypes, const ApplyRule::Callback& callback);
|
||||||
static bool IsValidSourceType(const String& sourceType);
|
static bool IsValidSourceType(const String& sourceType);
|
||||||
|
|
|
@ -317,13 +317,13 @@ bool ConfigItem::ValidateItems(void)
|
||||||
upq.Join();
|
upq.Join();
|
||||||
|
|
||||||
Log(LogInformation, "config", "Evaluating 'object' rules (step 1)...");
|
Log(LogInformation, "config", "Evaluating 'object' rules (step 1)...");
|
||||||
ObjectRule::EvaluateRules();
|
ObjectRule::EvaluateRules(false);
|
||||||
|
|
||||||
Log(LogInformation, "config", "Evaluating 'apply' rules...");
|
Log(LogInformation, "config", "Evaluating 'apply' rules...");
|
||||||
ApplyRule::EvaluateRules();
|
ApplyRule::EvaluateRules(true);
|
||||||
|
|
||||||
Log(LogInformation, "config", "Evaluating 'object' rules (step 2)...");
|
Log(LogInformation, "config", "Evaluating 'object' rules (step 2)...");
|
||||||
ObjectRule::EvaluateRules();
|
ObjectRule::EvaluateRules(true);
|
||||||
|
|
||||||
Log(LogInformation, "config", "Validating config items (step 2)...");
|
Log(LogInformation, "config", "Validating config items (step 2)...");
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ bool ObjectRule::EvaluateFilter(const Dictionary::Ptr& scope) const
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectRule::EvaluateRules(void)
|
void ObjectRule::EvaluateRules(bool clear)
|
||||||
{
|
{
|
||||||
std::pair<String, Callback> kv;
|
std::pair<String, Callback> kv;
|
||||||
BOOST_FOREACH(kv, m_Callbacks) {
|
BOOST_FOREACH(kv, m_Callbacks) {
|
||||||
|
@ -84,7 +84,8 @@ void ObjectRule::EvaluateRules(void)
|
||||||
callback(it->second);
|
callback(it->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Rules.clear();
|
if (clear)
|
||||||
|
m_Rules.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectRule::RegisterType(const String& sourceType, const ObjectRule::Callback& callback)
|
void ObjectRule::RegisterType(const String& sourceType, const ObjectRule::Callback& callback)
|
||||||
|
|
|
@ -48,7 +48,7 @@ public:
|
||||||
|
|
||||||
static void AddRule(const String& sourceType, const String& name, const AExpression::Ptr& expression,
|
static void AddRule(const String& sourceType, const String& name, const AExpression::Ptr& expression,
|
||||||
const AExpression::Ptr& filter, const DebugInfo& di, const Dictionary::Ptr& scope);
|
const AExpression::Ptr& filter, const DebugInfo& di, const Dictionary::Ptr& scope);
|
||||||
static void EvaluateRules(void);
|
static void EvaluateRules(bool clear);
|
||||||
|
|
||||||
static void RegisterType(const String& sourceType, const ObjectRule::Callback& callback);
|
static void RegisterType(const String& sourceType, const ObjectRule::Callback& callback);
|
||||||
static bool IsValidSourceType(const String& sourceType);
|
static bool IsValidSourceType(const String& sourceType);
|
||||||
|
|
Loading…
Reference in New Issue