From 8f3a1335dc4513ac20f99d7e12d42528a528a147 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Thu, 1 Aug 2019 14:03:40 +0200 Subject: [PATCH 1/2] Revert "API: Don't be so strict with the downtime start_time" This reverts commit 3b7cf5b9b55f2dfa933b0e5e89bc1285794f21a7. --- lib/icinga/apiactions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/icinga/apiactions.cpp b/lib/icinga/apiactions.cpp index f4a5a6f8a..9d7edbcc6 100644 --- a/lib/icinga/apiactions.cpp +++ b/lib/icinga/apiactions.cpp @@ -337,7 +337,7 @@ Dictionary::Ptr ApiActions::ScheduleDowntime(const ConfigObject::Ptr& object, String comment = HttpUtility::GetLastParameter(params, "comment"); double startTime = HttpUtility::GetLastParameter(params, "start_time"); double endTime = HttpUtility::GetLastParameter(params, "end_time"); - double now = Utility::GetTime() - 10; //Take a request delay into account. + double now = Utility::GetTime(); if (author.IsEmpty() || comment.IsEmpty()) return ApiActions::CreateResult(400, "Options 'author' and 'comment' must not be empty"); From f58d1ef7f7c012c7d5b037a9388ac93f04905956 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Thu, 1 Aug 2019 14:03:44 +0200 Subject: [PATCH 2/2] Revert "API: Improve error handling for 'schedule-downtime' action" This reverts commit 8ca38302fceeb05f99c703e1e66b234de996cbd5. --- lib/icinga/apiactions.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/icinga/apiactions.cpp b/lib/icinga/apiactions.cpp index 9d7edbcc6..757b37eca 100644 --- a/lib/icinga/apiactions.cpp +++ b/lib/icinga/apiactions.cpp @@ -337,16 +337,6 @@ Dictionary::Ptr ApiActions::ScheduleDowntime(const ConfigObject::Ptr& object, String comment = HttpUtility::GetLastParameter(params, "comment"); double startTime = HttpUtility::GetLastParameter(params, "start_time"); double endTime = HttpUtility::GetLastParameter(params, "end_time"); - double now = Utility::GetTime(); - - if (author.IsEmpty() || comment.IsEmpty()) - return ApiActions::CreateResult(400, "Options 'author' and 'comment' must not be empty"); - - if (startTime < now || endTime < now) - return ApiActions::CreateResult(400, "Options 'start_time' and 'end_time' must be greater than current timestamp"); - - if (endTime < startTime) - return ApiActions::CreateResult(400, "Option 'end_time' must be greater than 'start_time'"); Host::Ptr host; Service::Ptr service;