Require that max_check_attempts is greater than 0

fixes #4832
This commit is contained in:
Michael Friedrich 2017-02-07 13:27:27 +01:00
parent baaa52748c
commit d4277b4d70
2 changed files with 9 additions and 0 deletions

View File

@ -189,3 +189,11 @@ void Checkable::ValidateCheckInterval(double value, const ValidationUtils& utils
if (value <= 0)
BOOST_THROW_EXCEPTION(ValidationError(this, boost::assign::list_of("check_interval"), "Interval must be greater than 0."));
}
void Checkable::ValidateMaxCheckAttempts(int value, const ValidationUtils& utils)
{
ObjectImpl<Checkable>::ValidateMaxCheckAttempts(value, utils);
if (value <= 0)
BOOST_THROW_EXCEPTION(ValidationError(this, boost::assign::list_of("max_check_attempts"), "Value must be greater than 0."));
}

View File

@ -177,6 +177,7 @@ public:
std::set<intrusive_ptr<Dependency> > GetReverseDependencies(void) const;
virtual void ValidateCheckInterval(double value, const ValidationUtils& utils) override;
virtual void ValidateMaxCheckAttempts(int value, const ValidationUtils& utils) override;
static void IncreasePendingChecks(void);
static void DecreasePendingChecks(void);