mirror of
https://github.com/Icinga/icinga2.git
synced 2026-02-03 20:40:17 -05:00
Set zones of config objects originated from an apply rules via ApplyUtility::MakeCommonZone()
refs #6919
This commit is contained in:
parent
3c09390c81
commit
bb7f4c2b94
4 changed files with 28 additions and 12 deletions
|
|
@ -1,5 +1,6 @@
|
|||
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
||||
|
||||
#include "icinga/apply-utility.hpp"
|
||||
#include "icinga/dependency.hpp"
|
||||
#include "icinga/service.hpp"
|
||||
#include "config/configitembuilder.hpp"
|
||||
|
|
@ -47,10 +48,13 @@ bool Dependency::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, cons
|
|||
if (service)
|
||||
builder.AddExpression(new SetExpression(MakeIndexer(ScopeThis, "child_service_name"), OpSetLiteral, MakeLiteral(service->GetShortName()), di));
|
||||
|
||||
String zone = checkable->GetZoneName();
|
||||
{
|
||||
auto expr (ApplyUtility::MakeCommonZone(checkable->GetZoneName(), rule.GetZone(), di));
|
||||
|
||||
if (!zone.IsEmpty())
|
||||
builder.AddExpression(new SetExpression(MakeIndexer(ScopeThis, "zone"), OpSetLiteral, MakeLiteral(zone), di));
|
||||
if (expr) {
|
||||
builder.AddExpression(expr.release());
|
||||
}
|
||||
}
|
||||
|
||||
builder.AddExpression(new SetExpression(MakeIndexer(ScopeThis, "package"), OpSetLiteral, MakeLiteral(rule.GetPackage()), di));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
||||
|
||||
#include "icinga/apply-utility.hpp"
|
||||
#include "icinga/notification.hpp"
|
||||
#include "icinga/service.hpp"
|
||||
#include "config/configitembuilder.hpp"
|
||||
|
|
@ -46,10 +47,13 @@ bool Notification::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, co
|
|||
if (service)
|
||||
builder.AddExpression(new SetExpression(MakeIndexer(ScopeThis, "service_name"), OpSetLiteral, MakeLiteral(service->GetShortName()), di));
|
||||
|
||||
String zone = checkable->GetZoneName();
|
||||
{
|
||||
auto expr (ApplyUtility::MakeCommonZone(checkable->GetZoneName(), rule.GetZone(), di));
|
||||
|
||||
if (!zone.IsEmpty())
|
||||
builder.AddExpression(new SetExpression(MakeIndexer(ScopeThis, "zone"), OpSetLiteral, MakeLiteral(zone), di));
|
||||
if (expr) {
|
||||
builder.AddExpression(expr.release());
|
||||
}
|
||||
}
|
||||
|
||||
builder.AddExpression(new SetExpression(MakeIndexer(ScopeThis, "package"), OpSetLiteral, MakeLiteral(rule.GetPackage()), di));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
||||
|
||||
#include "icinga/apply-utility.hpp"
|
||||
#include "icinga/scheduleddowntime.hpp"
|
||||
#include "icinga/service.hpp"
|
||||
#include "config/configitembuilder.hpp"
|
||||
|
|
@ -45,10 +46,13 @@ bool ScheduledDowntime::EvaluateApplyRuleInstance(const Checkable::Ptr& checkabl
|
|||
if (service)
|
||||
builder.AddExpression(new SetExpression(MakeIndexer(ScopeThis, "service_name"), OpSetLiteral, MakeLiteral(service->GetShortName()), di));
|
||||
|
||||
String zone = checkable->GetZoneName();
|
||||
{
|
||||
auto expr (ApplyUtility::MakeCommonZone(checkable->GetZoneName(), rule.GetZone(), di));
|
||||
|
||||
if (!zone.IsEmpty())
|
||||
builder.AddExpression(new SetExpression(MakeIndexer(ScopeThis, "zone"), OpSetLiteral, MakeLiteral(zone), di));
|
||||
if (expr) {
|
||||
builder.AddExpression(expr.release());
|
||||
}
|
||||
}
|
||||
|
||||
builder.AddExpression(new SetExpression(MakeIndexer(ScopeThis, "package"), OpSetLiteral, MakeLiteral(rule.GetPackage()), di));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
||||
|
||||
#include "icinga/apply-utility.hpp"
|
||||
#include "icinga/service.hpp"
|
||||
#include "config/configitembuilder.hpp"
|
||||
#include "config/applyrule.hpp"
|
||||
|
|
@ -40,10 +41,13 @@ bool Service::EvaluateApplyRuleInstance(const Host::Ptr& host, const String& nam
|
|||
|
||||
builder.AddExpression(new SetExpression(MakeIndexer(ScopeThis, "name"), OpSetLiteral, MakeLiteral(name), di));
|
||||
|
||||
String zone = host->GetZoneName();
|
||||
{
|
||||
auto expr (ApplyUtility::MakeCommonZone(host->GetZoneName(), rule.GetZone(), di));
|
||||
|
||||
if (!zone.IsEmpty())
|
||||
builder.AddExpression(new SetExpression(MakeIndexer(ScopeThis, "zone"), OpSetLiteral, MakeLiteral(zone), di));
|
||||
if (expr) {
|
||||
builder.AddExpression(expr.release());
|
||||
}
|
||||
}
|
||||
|
||||
builder.AddExpression(new SetExpression(MakeIndexer(ScopeThis, "package"), OpSetLiteral, MakeLiteral(rule.GetPackage()), di));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue