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));