mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-27 15:44:11 +02:00
Cache locals of script frame used for group assign where eval
to avoid malloc(). This BREAKS assign where locals.x = 1.
This commit is contained in:
parent
805c78a7b9
commit
477d177b5a
@ -24,10 +24,20 @@ bool HostGroup::EvaluateObjectRule(const Host::Ptr& host, const ConfigItem::Ptr&
|
|||||||
|
|
||||||
CONTEXT("Evaluating rule for group '" << groupName << "'");
|
CONTEXT("Evaluating rule for group '" << groupName << "'");
|
||||||
|
|
||||||
ScriptFrame frame(true);
|
ScriptFrame frame (false);
|
||||||
if (group->GetScope())
|
|
||||||
group->GetScope()->CopyTo(frame.Locals);
|
if (group->GetScope()) {
|
||||||
frame.Locals->Set("host", host);
|
frame.Locals = new Dictionary();
|
||||||
|
|
||||||
|
if (group->GetScope()) {
|
||||||
|
group->GetScope()->CopyTo(frame.Locals);
|
||||||
|
}
|
||||||
|
|
||||||
|
host->GetFrozenLocalsForApply()->CopyTo(frame.Locals);
|
||||||
|
frame.Locals->Freeze();
|
||||||
|
} else {
|
||||||
|
frame.Locals = host->GetFrozenLocalsForApply();
|
||||||
|
}
|
||||||
|
|
||||||
if (!group->GetFilter()->Evaluate(frame).GetValue().ToBool())
|
if (!group->GetFilter()->Evaluate(frame).GetValue().ToBool())
|
||||||
return false;
|
return false;
|
||||||
|
@ -24,13 +24,20 @@ bool ServiceGroup::EvaluateObjectRule(const Service::Ptr& service, const ConfigI
|
|||||||
|
|
||||||
CONTEXT("Evaluating rule for group '" << groupName << "'");
|
CONTEXT("Evaluating rule for group '" << groupName << "'");
|
||||||
|
|
||||||
Host::Ptr host = service->GetHost();
|
ScriptFrame frame (false);
|
||||||
|
|
||||||
ScriptFrame frame(true);
|
if (group->GetScope()) {
|
||||||
if (group->GetScope())
|
frame.Locals = new Dictionary();
|
||||||
group->GetScope()->CopyTo(frame.Locals);
|
|
||||||
frame.Locals->Set("host", host);
|
if (group->GetScope()) {
|
||||||
frame.Locals->Set("service", service);
|
group->GetScope()->CopyTo(frame.Locals);
|
||||||
|
}
|
||||||
|
|
||||||
|
service->GetFrozenLocalsForApply()->CopyTo(frame.Locals);
|
||||||
|
frame.Locals->Freeze();
|
||||||
|
} else {
|
||||||
|
frame.Locals = service->GetFrozenLocalsForApply();
|
||||||
|
}
|
||||||
|
|
||||||
if (!group->GetFilter()->Evaluate(frame).GetValue().ToBool())
|
if (!group->GetFilter()->Evaluate(frame).GetValue().ToBool())
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user