Skip to content

Commit

Permalink
Apply: Inherit zone from parent object.
Browse files Browse the repository at this point in the history
Refs #6107
  • Loading branch information
gunnarbeutner committed May 9, 2014
1 parent dade476 commit 020ca0b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/icinga/dependency-apply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ bool Dependency::EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyR
di));
}

String zone = checkable->GetZone();

if (!zone.IsEmpty()) {
builder->AddExpression(make_shared<AExpression>(&AExpression::OpSet,
make_shared<AExpression>(&AExpression::OpLiteral, "zone", di),
make_shared<AExpression>(&AExpression::OpLiteral, zone, di),
di));
}

builder->AddExpression(rule.GetExpression());

ConfigItem::Ptr dependencyItem = builder->Compile();
Expand Down
9 changes: 9 additions & 0 deletions lib/icinga/notification-apply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ bool Notification::EvaluateApplyRule(const Checkable::Ptr& checkable, const Appl
di));
}

String zone = checkable->GetZone();

if (!zone.IsEmpty()) {
builder->AddExpression(make_shared<AExpression>(&AExpression::OpSet,
make_shared<AExpression>(&AExpression::OpLiteral, "zone", di),
make_shared<AExpression>(&AExpression::OpLiteral, zone, di),
di));
}

builder->AddExpression(rule.GetExpression());

ConfigItem::Ptr notificationItem = builder->Compile();
Expand Down
9 changes: 9 additions & 0 deletions lib/icinga/scheduleddowntime-apply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ bool ScheduledDowntime::EvaluateApplyRule(const Checkable::Ptr& checkable, const
di));
}

String zone = checkable->GetZone();

if (!zone.IsEmpty()) {
builder->AddExpression(make_shared<AExpression>(&AExpression::OpSet,
make_shared<AExpression>(&AExpression::OpLiteral, "zone", di),
make_shared<AExpression>(&AExpression::OpLiteral, zone, di),
di));
}

builder->AddExpression(rule.GetExpression());

ConfigItem::Ptr downtimeItem = builder->Compile();
Expand Down
9 changes: 9 additions & 0 deletions lib/icinga/service-apply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ bool Service::EvaluateApplyRule(const Host::Ptr& host, const ApplyRule& rule)
make_shared<AExpression>(&AExpression::OpLiteral, rule.GetName(), di),
di));

String zone = host->GetZone();

if (!zone.IsEmpty()) {
builder->AddExpression(make_shared<AExpression>(&AExpression::OpSet,
make_shared<AExpression>(&AExpression::OpLiteral, "zone", di),
make_shared<AExpression>(&AExpression::OpLiteral, zone, di),
di));
}

builder->AddExpression(rule.GetExpression());

ConfigItem::Ptr serviceItem = builder->Compile();
Expand Down

0 comments on commit 020ca0b

Please sign in to comment.