mirror of https://github.com/Icinga/icinga2.git
Redesign how templates are specified for slave services/notifications
Fixes #3706
This commit is contained in:
parent
f0093689fd
commit
22913c96bf
|
@ -72,7 +72,9 @@ type Host {
|
|||
|
||||
%attribute string "*",
|
||||
%attribute dictionary "*" {
|
||||
%attribute string "service",
|
||||
%attribute dictionary "templates" {
|
||||
%attribute string "*"
|
||||
},
|
||||
|
||||
%attribute string "short_name",
|
||||
|
||||
|
@ -108,8 +110,9 @@ type Host {
|
|||
%attribute dictionary "notifications" {
|
||||
%attribute string "*",
|
||||
%attribute dictionary "*" {
|
||||
%require "notification",
|
||||
%attribute string "notification",
|
||||
%attribute dictionary "templates" {
|
||||
%attribute string "*"
|
||||
},
|
||||
|
||||
%attribute dictionary "macros" {
|
||||
%attribute string "*"
|
||||
|
|
|
@ -223,11 +223,16 @@ void Host::UpdateSlaveServices(void)
|
|||
} else if (svcdesc.IsObjectType<Dictionary>()) {
|
||||
Dictionary::Ptr service = svcdesc;
|
||||
|
||||
String parent = service->Get("service");
|
||||
if (parent.IsEmpty())
|
||||
parent = svcname;
|
||||
Dictionary::Ptr templates = service->Get("templates");
|
||||
|
||||
builder->AddParent(parent);
|
||||
if (templates) {
|
||||
String tmpl;
|
||||
BOOST_FOREACH(tie(tuples::ignore, tmpl), templates) {
|
||||
builder->AddParent(tmpl);
|
||||
}
|
||||
} else {
|
||||
builder->AddParent(svcname);
|
||||
}
|
||||
|
||||
CopyServiceAttributes<true>(service, builder);
|
||||
} else {
|
||||
|
|
|
@ -156,11 +156,16 @@ void Service::UpdateSlaveNotifications(void)
|
|||
} else if (nfcdesc.IsObjectType<Dictionary>()) {
|
||||
Dictionary::Ptr notification = nfcdesc;
|
||||
|
||||
String parent = notification->Get("notification");
|
||||
if (parent.IsEmpty())
|
||||
parent = nfcname;
|
||||
Dictionary::Ptr templates = notification->Get("templates");
|
||||
|
||||
builder->AddParent(parent);
|
||||
if (templates) {
|
||||
String tmpl;
|
||||
BOOST_FOREACH(tie(tuples::ignore, tmpl), templates) {
|
||||
builder->AddParent(tmpl);
|
||||
}
|
||||
} else {
|
||||
builder->AddParent(nfcname);
|
||||
}
|
||||
|
||||
CopyNotificationAttributes(notification, builder);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue