mirror of https://github.com/Icinga/icinga2.git
Merge pull request #6920 from Icinga/bugfix/scheduleddowntime-zone
Downtime::AddDowntime(): place Downtimes in the same zone as the origin ScheduledDowntimes
This commit is contained in:
commit
feea76a80d
|
@ -267,7 +267,23 @@ String Downtime::AddDowntime(const Checkable::Ptr& checkable, const String& auth
|
|||
if (service)
|
||||
attrs->Set("service_name", service->GetShortName());
|
||||
|
||||
String zone = checkable->GetZoneName();
|
||||
String zone;
|
||||
|
||||
if (!scheduledDowntime.IsEmpty()) {
|
||||
auto sdt (ScheduledDowntime::GetByName(scheduledDowntime));
|
||||
|
||||
if (sdt) {
|
||||
auto sdtZone (sdt->GetZone());
|
||||
|
||||
if (sdtZone) {
|
||||
zone = sdtZone->GetName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (zone.IsEmpty()) {
|
||||
zone = checkable->GetZoneName();
|
||||
}
|
||||
|
||||
if (!zone.IsEmpty())
|
||||
attrs->Set("zone", zone);
|
||||
|
|
Loading…
Reference in New Issue