From e556d3c489cc4b2ff3b75254388cb82a30fa06c5 Mon Sep 17 00:00:00 2001 From: Julian Brost Date: Thu, 2 Sep 2021 16:18:55 +0200 Subject: [PATCH] Fix scheduling of downtimes for all services on child hosts The loop iterated over the services of the wrong host resulting in duplicate downtimes scheduled for services of the parent host instead of downtimes for services of the child host. --- lib/icinga/apiactions.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/icinga/apiactions.cpp b/lib/icinga/apiactions.cpp index 0cb8c98f9..2980bae65 100644 --- a/lib/icinga/apiactions.cpp +++ b/lib/icinga/apiactions.cpp @@ -458,12 +458,12 @@ Dictionary::Ptr ApiActions::ScheduleDowntime(const ConfigObject::Ptr& object, if (allServices && !childService) { ArrayData childServiceDowntimes; - for (const Service::Ptr& hostService : host->GetServices()) { + for (const Service::Ptr& childService : childHost->GetServices()) { Log(LogNotice, "ApiActions") - << "Creating downtime for service " << hostService->GetName() << " on child host " << host->GetName(); + << "Creating downtime for service " << childService->GetName() << " on child host " << childHost->GetName(); - Downtime::Ptr serviceDowntime = Downtime::AddDowntime(hostService, author, comment, startTime, endTime, - fixed, triggerName, duration); + Downtime::Ptr serviceDowntime = Downtime::AddDowntime(childService, author, comment, startTime, endTime, + fixed, triggerName, duration, String(), String(), childDowntimeName); String serviceDowntimeName = serviceDowntime->GetName(); childServiceDowntimes.push_back(new Dictionary({