Downtime::AddDowntime(): place Downtimes in the same zone as the origin ScheduledDowntimes

(cherry picked from commit ce847324bc)
This commit is contained in:
Alexander A. Klimov 2019-01-28 18:29:57 +01:00 committed by Michael Friedrich
parent ee915ed5d2
commit fb72633c5e
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);