Evaluate apply filters in the for loop

fixes #7610
This commit is contained in:
Gunnar Beutner 2015-01-29 12:38:25 +01:00
parent 88788685d3
commit fb323ee215
14 changed files with 136 additions and 75 deletions

View File

@ -427,8 +427,6 @@ You can also specifiy the check command that way.
notes = "Interface check for Port " + string(vars.port) + " in VLAN " + vars.vlan + " on Address " + vars.address + " QoS " + vars.qos notes = "Interface check for Port " + string(vars.port) + " in VLAN " + vars.vlan + " on Address " + vars.address + " QoS " + vars.qos
notes_url = "http://foreman.company.com/hosts/" + host.name notes_url = "http://foreman.company.com/hosts/" + host.name
action_url = "http://snmp.checker.company.com/" + host.name + "if-" + if_name action_url = "http://snmp.checker.company.com/" + host.name + "if-" + if_name
assign where host.vars.interfaces
} }
Note that numbers must be explicitely casted to string when adding to strings. Note that numbers must be explicitely casted to string when adding to strings.
@ -481,8 +479,6 @@ values for any object attribute specified in that apply rule.
notes_url = "http://foreman.company.com/hosts/" + host.name notes_url = "http://foreman.company.com/hosts/" + host.name
action_url = "http://snmp.checker.company.com/" + host.name + "/" + vars.customer_id action_url = "http://snmp.checker.company.com/" + host.name + "/" + vars.customer_id
assign where host.vars.hosting
} }
### <a id="groups"></a> Groups ### <a id="groups"></a> Groups
@ -1003,8 +999,6 @@ string values for passing multiple partitions to the `check_disk` check plugin.
vars.disk_wfree = 10 vars.disk_wfree = 10
vars.disk_cfree = 5 vars.disk_cfree = 5
assign where host.vars.local_disks
} }

View File

@ -366,8 +366,6 @@ Configuration example:
check_command = "disk" check_command = "disk"
vars += config vars += config
assign where host.vars.disks
} }
A similar example is used for the `http` services. That way you can make your A similar example is used for the `http` services. That way you can make your

View File

@ -61,8 +61,6 @@ apply Service for (http_vhost => config in host.vars.http_vhosts) {
check_command = "http" check_command = "http"
vars += config vars += config
assign where host.vars.http_vhosts
} }
apply Service for (disk => config in host.vars.disks) { apply Service for (disk => config in host.vars.disks) {
@ -71,8 +69,6 @@ apply Service for (disk => config in host.vars.disks) {
check_command = "disk" check_command = "disk"
vars += config vars += config
assign where host.vars.disks
} }
apply Service "icinga" { apply Service "icinga" {

View File

@ -215,3 +215,23 @@ Dictionary::Ptr Dictionary::ShallowClone(void) const
CopyTo(clone); CopyTo(clone);
return clone; return clone;
} }
/**
* Returns an array containing all keys
* which are currently set in this directory.
*
* @returns an array of key names
*/
std::vector<String> Dictionary::GetKeys(void) const
{
ASSERT(!OwnsLock());
ObjectLock olock(this);
std::vector<String> keys;
BOOST_FOREACH(const Dictionary::Pair& kv, m_Data) {
keys.push_back(kv.first);
}
return keys;
}

View File

@ -25,6 +25,7 @@
#include "base/value.hpp" #include "base/value.hpp"
#include <boost/range/iterator.hpp> #include <boost/range/iterator.hpp>
#include <map> #include <map>
#include <vector>
namespace icinga namespace icinga
{ {
@ -64,6 +65,8 @@ public:
void CopyTo(const Dictionary::Ptr& dest) const; void CopyTo(const Dictionary::Ptr& dest) const;
Dictionary::Ptr ShallowClone(void) const; Dictionary::Ptr ShallowClone(void) const;
std::vector<String> GetKeys(void) const;
static Object::Ptr GetPrototype(void); static Object::Ptr GetPrototype(void);
private: private:

View File

@ -996,16 +996,23 @@ apply:
DictExpression *exprl = dynamic_cast<DictExpression *>($8); DictExpression *exprl = dynamic_cast<DictExpression *>($8);
exprl->MakeInline(); exprl->MakeInline();
// assign && !ignore bool seen_assign = context->m_SeenAssign.top();
if (!context->m_SeenAssign.top())
BOOST_THROW_EXCEPTION(ScriptError("'apply' is missing 'assign'", DebugInfoRange(@2, @3)));
context->m_SeenAssign.pop(); context->m_SeenAssign.pop();
// assign && !ignore
if (!seen_assign && !context->m_FTerm.top())
BOOST_THROW_EXCEPTION(ScriptError("'apply' is missing 'assign'/'for'", DebugInfoRange(@2, @3)));
Expression *ignore = context->m_Ignore.top(); Expression *ignore = context->m_Ignore.top();
context->m_Ignore.pop(); context->m_Ignore.pop();
Expression *assign = context->m_Assign.top(); Expression *assign;
if (!seen_assign)
assign = MakeLiteral(true);
else
assign = context->m_Assign.top();
context->m_Assign.pop(); context->m_Assign.pop();
Expression *filter; Expression *filter;

View File

@ -41,8 +41,11 @@ void Dependency::RegisterApplyRuleHandler(void)
ApplyRule::RegisterType("Dependency", targets); ApplyRule::RegisterType("Dependency", targets);
} }
void Dependency::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule) bool Dependency::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule)
{ {
if (!rule.EvaluateFilter(frame))
return false;
DebugInfo di = rule.GetDebugInfo(); DebugInfo di = rule.GetDebugInfo();
Log(LogDebug, "Dependency") Log(LogDebug, "Dependency")
@ -72,6 +75,8 @@ void Dependency::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, cons
ConfigItem::Ptr dependencyItem = builder->Compile(); ConfigItem::Ptr dependencyItem = builder->Compile();
dependencyItem->Commit(); dependencyItem->Commit();
return true;
} }
bool Dependency::EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyRule& rule) bool Dependency::EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyRule& rule)
@ -93,27 +98,32 @@ bool Dependency::EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyR
if (service) if (service)
frame.Locals->Set("service", service); frame.Locals->Set("service", service);
if (!rule.EvaluateFilter(frame))
return false;
Value vinstances; Value vinstances;
if (rule.GetFTerm()) { if (rule.GetFTerm()) {
vinstances = rule.GetFTerm()->Evaluate(frame); try {
vinstances = rule.GetFTerm()->Evaluate(frame);
} catch (const std::exception&) {
/* Silently ignore errors here and assume there are no instances. */
return false;
}
} else { } else {
Array::Ptr instances = new Array(); Array::Ptr instances = new Array();
instances->Add(""); instances->Add("");
vinstances = instances; vinstances = instances;
} }
bool match = false;
if (vinstances.IsObjectType<Array>()) { if (vinstances.IsObjectType<Array>()) {
if (!rule.GetFVVar().IsEmpty()) if (!rule.GetFVVar().IsEmpty())
BOOST_THROW_EXCEPTION(ScriptError("Array iterator requires value to be an array.", di)); BOOST_THROW_EXCEPTION(ScriptError("Array iterator requires value to be an array.", di));
Array::Ptr arr = vinstances; Array::Ptr arr = vinstances;
Array::Ptr arrclone = arr->ShallowClone();
ObjectLock olock(arr); ObjectLock olock(arrclone);
BOOST_FOREACH(const String& instance, arr) { BOOST_FOREACH(const String& instance, arrclone) {
String name = rule.GetName(); String name = rule.GetName();
if (!rule.GetFKVar().IsEmpty()) { if (!rule.GetFKVar().IsEmpty()) {
@ -121,7 +131,8 @@ bool Dependency::EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyR
name += instance; name += instance;
} }
EvaluateApplyRuleInstance(checkable, name, frame, rule); if (EvaluateApplyRuleInstance(checkable, name, frame, rule))
match = true;
} }
} else if (vinstances.IsObjectType<Dictionary>()) { } else if (vinstances.IsObjectType<Dictionary>()) {
if (rule.GetFVVar().IsEmpty()) if (rule.GetFVVar().IsEmpty())
@ -129,16 +140,16 @@ bool Dependency::EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyR
Dictionary::Ptr dict = vinstances; Dictionary::Ptr dict = vinstances;
ObjectLock olock(dict); BOOST_FOREACH(const String& key, dict->GetKeys()) {
BOOST_FOREACH(const Dictionary::Pair& kv, dict) { frame.Locals->Set(rule.GetFKVar(), key);
frame.Locals->Set(rule.GetFKVar(), kv.first); frame.Locals->Set(rule.GetFVVar(), dict->Get(key));
frame.Locals->Set(rule.GetFVVar(), kv.second);
EvaluateApplyRuleInstance(checkable, rule.GetName() + kv.first, frame, rule); if (EvaluateApplyRuleInstance(checkable, rule.GetName() + key, frame, rule))
match = true;
} }
} }
return true; return match;
} }
void Dependency::EvaluateApplyRules(const Host::Ptr& host) void Dependency::EvaluateApplyRules(const Host::Ptr& host)

View File

@ -65,7 +65,7 @@ private:
Checkable::Ptr m_Parent; Checkable::Ptr m_Parent;
Checkable::Ptr m_Child; Checkable::Ptr m_Child;
static void EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule); static bool EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule);
static bool EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyRule& rule); static bool EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyRule& rule);
}; };

View File

@ -41,8 +41,11 @@ void Notification::RegisterApplyRuleHandler(void)
ApplyRule::RegisterType("Notification", targets); ApplyRule::RegisterType("Notification", targets);
} }
void Notification::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule) bool Notification::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule)
{ {
if (!rule.EvaluateFilter(frame))
return false;
DebugInfo di = rule.GetDebugInfo(); DebugInfo di = rule.GetDebugInfo();
Log(LogDebug, "Notification") Log(LogDebug, "Notification")
@ -71,6 +74,8 @@ void Notification::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, co
ConfigItem::Ptr notificationItem = builder->Compile(); ConfigItem::Ptr notificationItem = builder->Compile();
notificationItem->Commit(); notificationItem->Commit();
return true;
} }
bool Notification::EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyRule& rule) bool Notification::EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyRule& rule)
@ -92,19 +97,23 @@ bool Notification::EvaluateApplyRule(const Checkable::Ptr& checkable, const Appl
if (service) if (service)
frame.Locals->Set("service", service); frame.Locals->Set("service", service);
if (!rule.EvaluateFilter(frame))
return false;
Value vinstances; Value vinstances;
if (rule.GetFTerm()) { if (rule.GetFTerm()) {
vinstances = rule.GetFTerm()->Evaluate(frame); try {
vinstances = rule.GetFTerm()->Evaluate(frame);
} catch (const std::exception&) {
/* Silently ignore errors here and assume there are no instances. */
return false;
}
} else { } else {
Array::Ptr instances = new Array(); Array::Ptr instances = new Array();
instances->Add(""); instances->Add("");
vinstances = instances; vinstances = instances;
} }
bool match = false;
if (vinstances.IsObjectType<Array>()) { if (vinstances.IsObjectType<Array>()) {
if (!rule.GetFVVar().IsEmpty()) if (!rule.GetFVVar().IsEmpty())
BOOST_THROW_EXCEPTION(ScriptError("Array iterator requires value to be an array.", di)); BOOST_THROW_EXCEPTION(ScriptError("Array iterator requires value to be an array.", di));
@ -120,7 +129,8 @@ bool Notification::EvaluateApplyRule(const Checkable::Ptr& checkable, const Appl
name += instance; name += instance;
} }
EvaluateApplyRuleInstance(checkable, name, frame, rule); if (EvaluateApplyRuleInstance(checkable, name, frame, rule))
match = true;
} }
} else if (vinstances.IsObjectType<Dictionary>()) { } else if (vinstances.IsObjectType<Dictionary>()) {
if (rule.GetFVVar().IsEmpty()) if (rule.GetFVVar().IsEmpty())
@ -128,16 +138,16 @@ bool Notification::EvaluateApplyRule(const Checkable::Ptr& checkable, const Appl
Dictionary::Ptr dict = vinstances; Dictionary::Ptr dict = vinstances;
ObjectLock olock(dict); BOOST_FOREACH(const String& key, dict->GetKeys()) {
BOOST_FOREACH(const Dictionary::Pair& kv, dict) { frame.Locals->Set(rule.GetFKVar(), key);
frame.Locals->Set(rule.GetFKVar(), kv.first); frame.Locals->Set(rule.GetFVVar(), dict->Get(key));
frame.Locals->Set(rule.GetFVVar(), kv.second);
EvaluateApplyRuleInstance(checkable, rule.GetName() + kv.first, frame, rule); if (EvaluateApplyRuleInstance(checkable, rule.GetName() + key, frame, rule))
match = true;
} }
} }
return true; return match;
} }
void Notification::EvaluateApplyRules(const Host::Ptr& host) void Notification::EvaluateApplyRules(const Host::Ptr& host)

View File

@ -123,7 +123,7 @@ protected:
private: private:
void ExecuteNotificationHelper(NotificationType type, const User::Ptr& user, const CheckResult::Ptr& cr, bool force, const String& author = "", const String& text = ""); void ExecuteNotificationHelper(NotificationType type, const User::Ptr& user, const CheckResult::Ptr& cr, bool force, const String& author = "", const String& text = "");
static void EvaluateApplyRuleInstance(const intrusive_ptr<Checkable>& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule); static bool EvaluateApplyRuleInstance(const intrusive_ptr<Checkable>& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule);
static bool EvaluateApplyRule(const intrusive_ptr<Checkable>& checkable, const ApplyRule& rule); static bool EvaluateApplyRule(const intrusive_ptr<Checkable>& checkable, const ApplyRule& rule);
}; };

View File

@ -40,8 +40,11 @@ void ScheduledDowntime::RegisterApplyRuleHandler(void)
ApplyRule::RegisterType("ScheduledDowntime", targets); ApplyRule::RegisterType("ScheduledDowntime", targets);
} }
void ScheduledDowntime::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule) bool ScheduledDowntime::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule)
{ {
if (!rule.EvaluateFilter(frame))
return false;
DebugInfo di = rule.GetDebugInfo(); DebugInfo di = rule.GetDebugInfo();
Log(LogDebug, "ScheduledDowntime") Log(LogDebug, "ScheduledDowntime")
@ -70,6 +73,8 @@ void ScheduledDowntime::EvaluateApplyRuleInstance(const Checkable::Ptr& checkabl
ConfigItem::Ptr downtimeItem = builder->Compile(); ConfigItem::Ptr downtimeItem = builder->Compile();
downtimeItem->Commit(); downtimeItem->Commit();
return true;
} }
bool ScheduledDowntime::EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyRule& rule) bool ScheduledDowntime::EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyRule& rule)
@ -91,27 +96,32 @@ bool ScheduledDowntime::EvaluateApplyRule(const Checkable::Ptr& checkable, const
if (service) if (service)
frame.Locals->Set("service", service); frame.Locals->Set("service", service);
if (!rule.EvaluateFilter(frame))
return false;
Value vinstances; Value vinstances;
if (rule.GetFTerm()) { if (rule.GetFTerm()) {
vinstances = rule.GetFTerm()->Evaluate(frame); try {
vinstances = rule.GetFTerm()->Evaluate(frame);
} catch (const std::exception&) {
/* Silently ignore errors here and assume there are no instances. */
return false;
}
} else { } else {
Array::Ptr instances = new Array(); Array::Ptr instances = new Array();
instances->Add(""); instances->Add("");
vinstances = instances; vinstances = instances;
} }
bool match = false;
if (vinstances.IsObjectType<Array>()) { if (vinstances.IsObjectType<Array>()) {
if (!rule.GetFVVar().IsEmpty()) if (!rule.GetFVVar().IsEmpty())
BOOST_THROW_EXCEPTION(ScriptError("Array iterator requires value to be an array.", di)); BOOST_THROW_EXCEPTION(ScriptError("Array iterator requires value to be an array.", di));
Array::Ptr arr = vinstances; Array::Ptr arr = vinstances;
Array::Ptr arrclone = arr->ShallowClone();
ObjectLock olock(arr); ObjectLock olock(arrclone);
BOOST_FOREACH(const String& instance, arr) { BOOST_FOREACH(const String& instance, arrclone) {
String name = rule.GetName(); String name = rule.GetName();
if (!rule.GetFKVar().IsEmpty()) { if (!rule.GetFKVar().IsEmpty()) {
@ -119,7 +129,8 @@ bool ScheduledDowntime::EvaluateApplyRule(const Checkable::Ptr& checkable, const
name += instance; name += instance;
} }
EvaluateApplyRuleInstance(checkable, name, frame, rule); if (EvaluateApplyRuleInstance(checkable, name, frame, rule))
match = true;
} }
} else if (vinstances.IsObjectType<Dictionary>()) { } else if (vinstances.IsObjectType<Dictionary>()) {
if (rule.GetFVVar().IsEmpty()) if (rule.GetFVVar().IsEmpty())
@ -127,16 +138,16 @@ bool ScheduledDowntime::EvaluateApplyRule(const Checkable::Ptr& checkable, const
Dictionary::Ptr dict = vinstances; Dictionary::Ptr dict = vinstances;
ObjectLock olock(dict); BOOST_FOREACH(const String& key, dict->GetKeys()) {
BOOST_FOREACH(const Dictionary::Pair& kv, dict) { frame.Locals->Set(rule.GetFKVar(), key);
frame.Locals->Set(rule.GetFKVar(), kv.first); frame.Locals->Set(rule.GetFVVar(), dict->Get(key));
frame.Locals->Set(rule.GetFVVar(), kv.second);
EvaluateApplyRuleInstance(checkable, rule.GetName() + kv.first, frame, rule); if (EvaluateApplyRuleInstance(checkable, rule.GetName() + key, frame, rule))
match = true;
} }
} }
return true; return match;
} }
void ScheduledDowntime::EvaluateApplyRules(const Host::Ptr& host) void ScheduledDowntime::EvaluateApplyRules(const Host::Ptr& host)

View File

@ -63,7 +63,7 @@ private:
std::pair<double, double> FindNextSegment(void); std::pair<double, double> FindNextSegment(void);
void CreateNextDowntime(void); void CreateNextDowntime(void);
static void EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule); static bool EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule);
static bool EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyRule& rule); static bool EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyRule& rule);
}; };

View File

@ -39,8 +39,11 @@ void Service::RegisterApplyRuleHandler(void)
ApplyRule::RegisterType("Service", targets); ApplyRule::RegisterType("Service", targets);
} }
void Service::EvaluateApplyRuleInstance(const Host::Ptr& host, const String& name, ScriptFrame& frame, const ApplyRule& rule) bool Service::EvaluateApplyRuleInstance(const Host::Ptr& host, const String& name, ScriptFrame& frame, const ApplyRule& rule)
{ {
if (!rule.EvaluateFilter(frame))
return false;
DebugInfo di = rule.GetDebugInfo(); DebugInfo di = rule.GetDebugInfo();
Log(LogDebug, "Service") Log(LogDebug, "Service")
@ -64,6 +67,8 @@ void Service::EvaluateApplyRuleInstance(const Host::Ptr& host, const String& nam
ConfigItem::Ptr serviceItem = builder->Compile(); ConfigItem::Ptr serviceItem = builder->Compile();
serviceItem->Commit(); serviceItem->Commit();
return true;
} }
bool Service::EvaluateApplyRule(const Host::Ptr& host, const ApplyRule& rule) bool Service::EvaluateApplyRule(const Host::Ptr& host, const ApplyRule& rule)
@ -79,27 +84,32 @@ bool Service::EvaluateApplyRule(const Host::Ptr& host, const ApplyRule& rule)
rule.GetScope()->CopyTo(frame.Locals); rule.GetScope()->CopyTo(frame.Locals);
frame.Locals->Set("host", host); frame.Locals->Set("host", host);
if (!rule.EvaluateFilter(frame))
return false;
Value vinstances; Value vinstances;
if (rule.GetFTerm()) { if (rule.GetFTerm()) {
vinstances = rule.GetFTerm()->Evaluate(frame); try {
vinstances = rule.GetFTerm()->Evaluate(frame);
} catch (const std::exception&) {
/* Silently ignore errors here and assume there are no instances. */
return false;
}
} else { } else {
Array::Ptr instances = new Array(); Array::Ptr instances = new Array();
instances->Add(""); instances->Add("");
vinstances = instances; vinstances = instances;
} }
bool match = false;
if (vinstances.IsObjectType<Array>()) { if (vinstances.IsObjectType<Array>()) {
if (!rule.GetFVVar().IsEmpty()) if (!rule.GetFVVar().IsEmpty())
BOOST_THROW_EXCEPTION(ScriptError("Array iterator requires value to be an array.", di)); BOOST_THROW_EXCEPTION(ScriptError("Array iterator requires value to be an array.", di));
Array::Ptr arr = vinstances; Array::Ptr arr = vinstances;
Array::Ptr arrclone = arr->ShallowClone();
ObjectLock olock(arr); ObjectLock olock(arrclone);
BOOST_FOREACH(const String& instance, arr) { BOOST_FOREACH(const String& instance, arrclone) {
String name = rule.GetName(); String name = rule.GetName();
if (!rule.GetFKVar().IsEmpty()) { if (!rule.GetFKVar().IsEmpty()) {
@ -107,7 +117,8 @@ bool Service::EvaluateApplyRule(const Host::Ptr& host, const ApplyRule& rule)
name += instance; name += instance;
} }
EvaluateApplyRuleInstance(host, name, frame, rule); if (EvaluateApplyRuleInstance(host, name, frame, rule))
match = true;
} }
} else if (vinstances.IsObjectType<Dictionary>()) { } else if (vinstances.IsObjectType<Dictionary>()) {
if (rule.GetFVVar().IsEmpty()) if (rule.GetFVVar().IsEmpty())
@ -115,16 +126,16 @@ bool Service::EvaluateApplyRule(const Host::Ptr& host, const ApplyRule& rule)
Dictionary::Ptr dict = vinstances; Dictionary::Ptr dict = vinstances;
ObjectLock olock(dict); BOOST_FOREACH(const String& key, dict->GetKeys()) {
BOOST_FOREACH(const Dictionary::Pair& kv, dict) { frame.Locals->Set(rule.GetFKVar(), key);
frame.Locals->Set(rule.GetFKVar(), kv.first); frame.Locals->Set(rule.GetFVVar(), dict->Get(key));
frame.Locals->Set(rule.GetFVVar(), kv.second);
EvaluateApplyRuleInstance(host, rule.GetName() + kv.first, frame, rule); if (EvaluateApplyRuleInstance(host, rule.GetName() + key, frame, rule))
match = true;
} }
} }
return true; return match;
} }
void Service::EvaluateApplyRules(const Host::Ptr& host) void Service::EvaluateApplyRules(const Host::Ptr& host)

View File

@ -61,7 +61,7 @@ protected:
private: private:
Host::Ptr m_Host; Host::Ptr m_Host;
static void EvaluateApplyRuleInstance(const Host::Ptr& host, const String& name, ScriptFrame& frame, const ApplyRule& rule); static bool EvaluateApplyRuleInstance(const Host::Ptr& host, const String& name, ScriptFrame& frame, const ApplyRule& rule);
static bool EvaluateApplyRule(const Host::Ptr& host, const ApplyRule& rule); static bool EvaluateApplyRule(const Host::Ptr& host, const ApplyRule& rule);
}; };