From 8cbd4820725655e3c4ae06aef78308183be016da Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Mon, 28 Jan 2019 17:33:05 +0100 Subject: [PATCH] Don't allow retry_interval <= 0 --- lib/icinga/checkable.cpp | 8 ++++++++ lib/icinga/checkable.hpp | 1 + 2 files changed, 9 insertions(+) diff --git a/lib/icinga/checkable.cpp b/lib/icinga/checkable.cpp index fe2fed9e3..e745d76cb 100644 --- a/lib/icinga/checkable.cpp +++ b/lib/icinga/checkable.cpp @@ -198,6 +198,14 @@ void Checkable::ValidateCheckInterval(const Lazy& lvalue, const Validati BOOST_THROW_EXCEPTION(ValidationError(this, { "check_interval" }, "Interval must be greater than 0.")); } +void Checkable::ValidateRetryInterval(const Lazy& lvalue, const ValidationUtils& utils) +{ + ObjectImpl::ValidateRetryInterval(lvalue, utils); + + if (lvalue() <= 0) + BOOST_THROW_EXCEPTION(ValidationError(this, { "retry_interval" }, "Interval must be greater than 0.")); +} + void Checkable::ValidateMaxCheckAttempts(const Lazy& lvalue, const ValidationUtils& utils) { ObjectImpl::ValidateMaxCheckAttempts(lvalue, utils); diff --git a/lib/icinga/checkable.hpp b/lib/icinga/checkable.hpp index 141d0a43c..824f41b8d 100644 --- a/lib/icinga/checkable.hpp +++ b/lib/icinga/checkable.hpp @@ -192,6 +192,7 @@ public: std::vector > GetReverseDependencies() const; void ValidateCheckInterval(const Lazy& lvalue, const ValidationUtils& value) final; + void ValidateRetryInterval(const Lazy& lvalue, const ValidationUtils& value) final; void ValidateMaxCheckAttempts(const Lazy& lvalue, const ValidationUtils& value) final; static void IncreasePendingChecks();