mirror of https://github.com/Icinga/icinga2.git
Apply rules: import default templates first
... to allow to override the attributes they set. refs #7914
This commit is contained in:
parent
b06ea2bef7
commit
f311dfb775
|
@ -35,6 +35,8 @@ bool Dependency::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, cons
|
||||||
builder.SetScope(frame.Locals->ShallowClone());
|
builder.SetScope(frame.Locals->ShallowClone());
|
||||||
builder.SetIgnoreOnError(rule.GetIgnoreOnError());
|
builder.SetIgnoreOnError(rule.GetIgnoreOnError());
|
||||||
|
|
||||||
|
builder.AddExpression(new ImportDefaultTemplatesExpression());
|
||||||
|
|
||||||
Host::Ptr host;
|
Host::Ptr host;
|
||||||
Service::Ptr service;
|
Service::Ptr service;
|
||||||
tie(host, service) = GetHostService(checkable);
|
tie(host, service) = GetHostService(checkable);
|
||||||
|
@ -52,8 +54,6 @@ bool Dependency::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, cons
|
||||||
|
|
||||||
builder.AddExpression(new SetExpression(MakeIndexer(ScopeThis, "package"), OpSetLiteral, MakeLiteral(rule.GetPackage()), di));
|
builder.AddExpression(new SetExpression(MakeIndexer(ScopeThis, "package"), OpSetLiteral, MakeLiteral(rule.GetPackage()), di));
|
||||||
|
|
||||||
builder.AddExpression(new ImportDefaultTemplatesExpression());
|
|
||||||
|
|
||||||
builder.AddExpression(new OwnedExpression(rule.GetExpression()));
|
builder.AddExpression(new OwnedExpression(rule.GetExpression()));
|
||||||
|
|
||||||
ConfigItem::Ptr dependencyItem = builder.Compile();
|
ConfigItem::Ptr dependencyItem = builder.Compile();
|
||||||
|
|
|
@ -35,6 +35,8 @@ bool Notification::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, co
|
||||||
builder.SetScope(frame.Locals->ShallowClone());
|
builder.SetScope(frame.Locals->ShallowClone());
|
||||||
builder.SetIgnoreOnError(rule.GetIgnoreOnError());
|
builder.SetIgnoreOnError(rule.GetIgnoreOnError());
|
||||||
|
|
||||||
|
builder.AddExpression(new ImportDefaultTemplatesExpression());
|
||||||
|
|
||||||
Host::Ptr host;
|
Host::Ptr host;
|
||||||
Service::Ptr service;
|
Service::Ptr service;
|
||||||
tie(host, service) = GetHostService(checkable);
|
tie(host, service) = GetHostService(checkable);
|
||||||
|
@ -53,8 +55,6 @@ bool Notification::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, co
|
||||||
|
|
||||||
builder.AddExpression(new OwnedExpression(rule.GetExpression()));
|
builder.AddExpression(new OwnedExpression(rule.GetExpression()));
|
||||||
|
|
||||||
builder.AddExpression(new ImportDefaultTemplatesExpression());
|
|
||||||
|
|
||||||
ConfigItem::Ptr notificationItem = builder.Compile();
|
ConfigItem::Ptr notificationItem = builder.Compile();
|
||||||
notificationItem->Register();
|
notificationItem->Register();
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,8 @@ bool ScheduledDowntime::EvaluateApplyRuleInstance(const Checkable::Ptr& checkabl
|
||||||
builder.SetScope(frame.Locals->ShallowClone());
|
builder.SetScope(frame.Locals->ShallowClone());
|
||||||
builder.SetIgnoreOnError(rule.GetIgnoreOnError());
|
builder.SetIgnoreOnError(rule.GetIgnoreOnError());
|
||||||
|
|
||||||
|
builder.AddExpression(new ImportDefaultTemplatesExpression());
|
||||||
|
|
||||||
Host::Ptr host;
|
Host::Ptr host;
|
||||||
Service::Ptr service;
|
Service::Ptr service;
|
||||||
tie(host, service) = GetHostService(checkable);
|
tie(host, service) = GetHostService(checkable);
|
||||||
|
@ -52,8 +54,6 @@ bool ScheduledDowntime::EvaluateApplyRuleInstance(const Checkable::Ptr& checkabl
|
||||||
|
|
||||||
builder.AddExpression(new OwnedExpression(rule.GetExpression()));
|
builder.AddExpression(new OwnedExpression(rule.GetExpression()));
|
||||||
|
|
||||||
builder.AddExpression(new ImportDefaultTemplatesExpression());
|
|
||||||
|
|
||||||
ConfigItem::Ptr downtimeItem = builder.Compile();
|
ConfigItem::Ptr downtimeItem = builder.Compile();
|
||||||
downtimeItem->Register();
|
downtimeItem->Register();
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,8 @@ bool Service::EvaluateApplyRuleInstance(const Host::Ptr& host, const String& nam
|
||||||
builder.SetScope(frame.Locals->ShallowClone());
|
builder.SetScope(frame.Locals->ShallowClone());
|
||||||
builder.SetIgnoreOnError(rule.GetIgnoreOnError());
|
builder.SetIgnoreOnError(rule.GetIgnoreOnError());
|
||||||
|
|
||||||
|
builder.AddExpression(new ImportDefaultTemplatesExpression());
|
||||||
|
|
||||||
builder.AddExpression(new SetExpression(MakeIndexer(ScopeThis, "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(ScopeThis, "name"), OpSetLiteral, MakeLiteral(name), di));
|
builder.AddExpression(new SetExpression(MakeIndexer(ScopeThis, "name"), OpSetLiteral, MakeLiteral(name), di));
|
||||||
|
@ -47,8 +49,6 @@ bool Service::EvaluateApplyRuleInstance(const Host::Ptr& host, const String& nam
|
||||||
|
|
||||||
builder.AddExpression(new OwnedExpression(rule.GetExpression()));
|
builder.AddExpression(new OwnedExpression(rule.GetExpression()));
|
||||||
|
|
||||||
builder.AddExpression(new ImportDefaultTemplatesExpression());
|
|
||||||
|
|
||||||
ConfigItem::Ptr serviceItem = builder.Compile();
|
ConfigItem::Ptr serviceItem = builder.Compile();
|
||||||
serviceItem->Register();
|
serviceItem->Register();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue