mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-15 09:44:31 +02:00
parent
03ce0ec908
commit
f69c0bd5a2
@ -521,7 +521,7 @@ lterm: library
|
|||||||
FunctionExpression *fexpr = new FunctionExpression(*$4, $6, $7, @$);
|
FunctionExpression *fexpr = new FunctionExpression(*$4, $6, $7, @$);
|
||||||
delete $4;
|
delete $4;
|
||||||
|
|
||||||
$$ = new SetExpression(MakeIndexer(ScopeCurrent, $2), OpSetLiteral, fexpr, @$);
|
$$ = new SetExpression(MakeIndexer(ScopeThis, $2), OpSetLiteral, fexpr, @$);
|
||||||
free($2);
|
free($2);
|
||||||
}
|
}
|
||||||
| T_CONST T_IDENTIFIER T_SET rterm
|
| T_CONST T_IDENTIFIER T_SET rterm
|
||||||
@ -780,7 +780,7 @@ rterm_no_side_effect: T_STRING
|
|||||||
| rterm_scope_require_side_effect
|
| rterm_scope_require_side_effect
|
||||||
{
|
{
|
||||||
Expression *expr = $1;
|
Expression *expr = $1;
|
||||||
BindToScope(expr, ScopeCurrent);
|
BindToScope(expr, ScopeThis);
|
||||||
$$ = expr;
|
$$ = expr;
|
||||||
}
|
}
|
||||||
| '('
|
| '('
|
||||||
|
@ -94,7 +94,7 @@ ConfigItem::Ptr ConfigItemBuilder::Compile(void)
|
|||||||
Array::Ptr templateArray = new Array();
|
Array::Ptr templateArray = new Array();
|
||||||
templateArray->Add(m_Name);
|
templateArray->Add(m_Name);
|
||||||
|
|
||||||
exprs.push_back(new SetExpression(MakeIndexer(ScopeCurrent, "templates"), OpSetAdd,
|
exprs.push_back(new SetExpression(MakeIndexer(ScopeThis, "templates"), OpSetAdd,
|
||||||
new LiteralExpression(templateArray), m_DebugInfo));
|
new LiteralExpression(templateArray), m_DebugInfo));
|
||||||
|
|
||||||
DictExpression *dexpr = new DictExpression(m_Expressions, m_DebugInfo);
|
DictExpression *dexpr = new DictExpression(m_Expressions, m_DebugInfo);
|
||||||
|
@ -473,8 +473,6 @@ ExpressionResult GetScopeExpression::DoEvaluate(ScriptFrame& frame, DebugHint *d
|
|||||||
{
|
{
|
||||||
if (m_ScopeSpec == ScopeLocal)
|
if (m_ScopeSpec == ScopeLocal)
|
||||||
return frame.Locals;
|
return frame.Locals;
|
||||||
else if (m_ScopeSpec == ScopeCurrent)
|
|
||||||
return frame.Self;
|
|
||||||
else if (m_ScopeSpec == ScopeThis)
|
else if (m_ScopeSpec == ScopeThis)
|
||||||
return frame.Self;
|
return frame.Self;
|
||||||
else if (m_ScopeSpec == ScopeGlobal)
|
else if (m_ScopeSpec == ScopeGlobal)
|
||||||
|
@ -123,7 +123,6 @@ enum CombinedSetOp
|
|||||||
enum ScopeSpecifier
|
enum ScopeSpecifier
|
||||||
{
|
{
|
||||||
ScopeLocal,
|
ScopeLocal,
|
||||||
ScopeCurrent,
|
|
||||||
ScopeThis,
|
ScopeThis,
|
||||||
ScopeGlobal
|
ScopeGlobal
|
||||||
};
|
};
|
||||||
|
@ -60,16 +60,16 @@ bool Dependency::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, cons
|
|||||||
Service::Ptr service;
|
Service::Ptr service;
|
||||||
tie(host, service) = GetHostService(checkable);
|
tie(host, service) = GetHostService(checkable);
|
||||||
|
|
||||||
builder->AddExpression(new SetExpression(MakeIndexer(ScopeCurrent, "parent_host_name"), OpSetLiteral, MakeLiteral(host->GetName()), di));
|
builder->AddExpression(new SetExpression(MakeIndexer(ScopeThis, "parent_host_name"), OpSetLiteral, MakeLiteral(host->GetName()), di));
|
||||||
builder->AddExpression(new SetExpression(MakeIndexer(ScopeCurrent, "child_host_name"), OpSetLiteral, MakeLiteral(host->GetName()), di));
|
builder->AddExpression(new SetExpression(MakeIndexer(ScopeThis, "child_host_name"), OpSetLiteral, MakeLiteral(host->GetName()), di));
|
||||||
|
|
||||||
if (service)
|
if (service)
|
||||||
builder->AddExpression(new SetExpression(MakeIndexer(ScopeCurrent, "child_service_name"), OpSetLiteral, MakeLiteral(service->GetShortName()), di));
|
builder->AddExpression(new SetExpression(MakeIndexer(ScopeThis, "child_service_name"), OpSetLiteral, MakeLiteral(service->GetShortName()), di));
|
||||||
|
|
||||||
String zone = checkable->GetZoneName();
|
String zone = checkable->GetZoneName();
|
||||||
|
|
||||||
if (!zone.IsEmpty())
|
if (!zone.IsEmpty())
|
||||||
builder->AddExpression(new SetExpression(MakeIndexer(ScopeCurrent, "zone"), OpSetLiteral, MakeLiteral(zone), di));
|
builder->AddExpression(new SetExpression(MakeIndexer(ScopeThis, "zone"), OpSetLiteral, MakeLiteral(zone), di));
|
||||||
|
|
||||||
builder->AddExpression(new OwnedExpression(rule.GetExpression()));
|
builder->AddExpression(new OwnedExpression(rule.GetExpression()));
|
||||||
|
|
||||||
|
@ -60,15 +60,15 @@ bool Notification::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, co
|
|||||||
Service::Ptr service;
|
Service::Ptr service;
|
||||||
tie(host, service) = GetHostService(checkable);
|
tie(host, service) = GetHostService(checkable);
|
||||||
|
|
||||||
builder->AddExpression(new SetExpression(MakeIndexer(ScopeCurrent, "host_name"), OpSetLiteral, MakeLiteral(host->GetName()), di));
|
builder->AddExpression(new SetExpression(MakeIndexer(ScopeThis, "host_name"), OpSetLiteral, MakeLiteral(host->GetName()), di));
|
||||||
|
|
||||||
if (service)
|
if (service)
|
||||||
builder->AddExpression(new SetExpression(MakeIndexer(ScopeCurrent, "service_name"), OpSetLiteral, MakeLiteral(service->GetShortName()), di));
|
builder->AddExpression(new SetExpression(MakeIndexer(ScopeThis, "service_name"), OpSetLiteral, MakeLiteral(service->GetShortName()), di));
|
||||||
|
|
||||||
String zone = checkable->GetZoneName();
|
String zone = checkable->GetZoneName();
|
||||||
|
|
||||||
if (!zone.IsEmpty())
|
if (!zone.IsEmpty())
|
||||||
builder->AddExpression(new SetExpression(MakeIndexer(ScopeCurrent, "zone"), OpSetLiteral, MakeLiteral(zone), di));
|
builder->AddExpression(new SetExpression(MakeIndexer(ScopeThis, "zone"), OpSetLiteral, MakeLiteral(zone), di));
|
||||||
|
|
||||||
builder->AddExpression(new OwnedExpression(rule.GetExpression()));
|
builder->AddExpression(new OwnedExpression(rule.GetExpression()));
|
||||||
|
|
||||||
|
@ -59,15 +59,15 @@ bool ScheduledDowntime::EvaluateApplyRuleInstance(const Checkable::Ptr& checkabl
|
|||||||
Service::Ptr service;
|
Service::Ptr service;
|
||||||
tie(host, service) = GetHostService(checkable);
|
tie(host, service) = GetHostService(checkable);
|
||||||
|
|
||||||
builder->AddExpression(new SetExpression(MakeIndexer(ScopeCurrent, "host_name"), OpSetLiteral, MakeLiteral(host->GetName()), di));
|
builder->AddExpression(new SetExpression(MakeIndexer(ScopeThis, "host_name"), OpSetLiteral, MakeLiteral(host->GetName()), di));
|
||||||
|
|
||||||
if (service)
|
if (service)
|
||||||
builder->AddExpression(new SetExpression(MakeIndexer(ScopeCurrent, "service_name"), OpSetLiteral, MakeLiteral(service->GetShortName()), di));
|
builder->AddExpression(new SetExpression(MakeIndexer(ScopeThis, "service_name"), OpSetLiteral, MakeLiteral(service->GetShortName()), di));
|
||||||
|
|
||||||
String zone = checkable->GetZoneName();
|
String zone = checkable->GetZoneName();
|
||||||
|
|
||||||
if (!zone.IsEmpty())
|
if (!zone.IsEmpty())
|
||||||
builder->AddExpression(new SetExpression(MakeIndexer(ScopeCurrent, "zone"), OpSetLiteral, MakeLiteral(zone), di));
|
builder->AddExpression(new SetExpression(MakeIndexer(ScopeThis, "zone"), OpSetLiteral, MakeLiteral(zone), di));
|
||||||
|
|
||||||
builder->AddExpression(new OwnedExpression(rule.GetExpression()));
|
builder->AddExpression(new OwnedExpression(rule.GetExpression()));
|
||||||
|
|
||||||
|
@ -54,14 +54,14 @@ bool Service::EvaluateApplyRuleInstance(const Host::Ptr& host, const String& nam
|
|||||||
builder->SetName(name);
|
builder->SetName(name);
|
||||||
builder->SetScope(frame.Locals->ShallowClone());
|
builder->SetScope(frame.Locals->ShallowClone());
|
||||||
|
|
||||||
builder->AddExpression(new SetExpression(MakeIndexer(ScopeCurrent, "host_name"), OpSetLiteral, MakeLiteral(host->GetName()), di));
|
builder->AddExpression(new SetExpression(MakeIndexer(ScopeThis, "host_name"), OpSetLiteral, MakeLiteral(host->GetName()), di));
|
||||||
|
|
||||||
builder->AddExpression(new SetExpression(MakeIndexer(ScopeCurrent, "name"), OpSetLiteral, MakeLiteral(name), di));
|
builder->AddExpression(new SetExpression(MakeIndexer(ScopeThis, "name"), OpSetLiteral, MakeLiteral(name), di));
|
||||||
|
|
||||||
String zone = host->GetZoneName();
|
String zone = host->GetZoneName();
|
||||||
|
|
||||||
if (!zone.IsEmpty())
|
if (!zone.IsEmpty())
|
||||||
builder->AddExpression(new SetExpression(MakeIndexer(ScopeCurrent, "zone"), OpSetLiteral, MakeLiteral(zone), di));
|
builder->AddExpression(new SetExpression(MakeIndexer(ScopeThis, "zone"), OpSetLiteral, MakeLiteral(zone), di));
|
||||||
|
|
||||||
builder->AddExpression(new OwnedExpression(rule.GetExpression()));
|
builder->AddExpression(new OwnedExpression(rule.GetExpression()));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user