From: Gunnar Beutner Date: Mon, 23 Mar 2015 14:52:09 +0000 (+0100) Subject: Fix incorrect variable values for apply+for X-Git-Tag: v2.4.0~775 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d3c0c1e42bf9a463f9b2c61ab5d8caddd801a294;p=icinga2 Fix incorrect variable values for apply+for fixes #8851 --- diff --git a/lib/icinga/dependency-apply.cpp b/lib/icinga/dependency-apply.cpp index be761bd1b..14d2b84bf 100644 --- a/lib/icinga/dependency-apply.cpp +++ b/lib/icinga/dependency-apply.cpp @@ -54,7 +54,7 @@ bool Dependency::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, cons ConfigItemBuilder::Ptr builder = new ConfigItemBuilder(di); builder->SetType("Dependency"); builder->SetName(name); - builder->SetScope(frame.Locals); + builder->SetScope(frame.Locals->ShallowClone()); Host::Ptr host; Service::Ptr service; diff --git a/lib/icinga/notification-apply.cpp b/lib/icinga/notification-apply.cpp index d52ec8500..fd8e5a3b3 100644 --- a/lib/icinga/notification-apply.cpp +++ b/lib/icinga/notification-apply.cpp @@ -54,7 +54,7 @@ bool Notification::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, co ConfigItemBuilder::Ptr builder = new ConfigItemBuilder(di); builder->SetType("Notification"); builder->SetName(name); - builder->SetScope(frame.Locals); + builder->SetScope(frame.Locals->ShallowClone()); Host::Ptr host; Service::Ptr service; diff --git a/lib/icinga/scheduleddowntime-apply.cpp b/lib/icinga/scheduleddowntime-apply.cpp index 32f86c449..af5812304 100644 --- a/lib/icinga/scheduleddowntime-apply.cpp +++ b/lib/icinga/scheduleddowntime-apply.cpp @@ -53,7 +53,7 @@ bool ScheduledDowntime::EvaluateApplyRuleInstance(const Checkable::Ptr& checkabl ConfigItemBuilder::Ptr builder = new ConfigItemBuilder(di); builder->SetType("ScheduledDowntime"); builder->SetName(name); - builder->SetScope(frame.Locals); + builder->SetScope(frame.Locals->ShallowClone()); Host::Ptr host; Service::Ptr service; diff --git a/lib/icinga/service-apply.cpp b/lib/icinga/service-apply.cpp index 065dd5f93..6af43204b 100644 --- a/lib/icinga/service-apply.cpp +++ b/lib/icinga/service-apply.cpp @@ -52,7 +52,7 @@ bool Service::EvaluateApplyRuleInstance(const Host::Ptr& host, const String& nam ConfigItemBuilder::Ptr builder = new ConfigItemBuilder(di); builder->SetType("Service"); builder->SetName(name); - builder->SetScope(frame.Locals); + builder->SetScope(frame.Locals->ShallowClone()); builder->AddExpression(new SetExpression(MakeIndexer(ScopeCurrent, "host_name"), OpSetLiteral, MakeLiteral(host->GetName()), di));