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:
Michael Friedrich 2019-01-29 13:35:32 +01:00 committed by GitHub
commit feea76a80d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 1 deletions

View File

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