mirror of
https://github.com/Icinga/icinga2.git
synced 2026-02-18 18:19:13 -05:00
Merge ed5a9ea103 into 333534096e
This commit is contained in:
commit
81f45a5ae2
4 changed files with 18 additions and 0 deletions
|
|
@ -584,6 +584,14 @@ void Downtime::ValidateEndTime(const Lazy<Timestamp>& lvalue, const ValidationUt
|
|||
BOOST_THROW_EXCEPTION(ValidationError(this, { "end_time" }, "End time must be greater than 0."));
|
||||
}
|
||||
|
||||
void Downtime::ValidateDuration(const Lazy<Timestamp>& lvalue, const ValidationUtils& utils)
|
||||
{
|
||||
ObjectImpl<Downtime>::ValidateDuration(lvalue, utils);
|
||||
|
||||
if (lvalue() < 0)
|
||||
BOOST_THROW_EXCEPTION(ValidationError(this, { "duration" }, "Duration must be positive."));
|
||||
}
|
||||
|
||||
DowntimeChildOptions Downtime::ChildOptionsFromValue(const Value& options)
|
||||
{
|
||||
if (options == "DowntimeNoChildren")
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ protected:
|
|||
|
||||
void ValidateStartTime(const Lazy<Timestamp>& lvalue, const ValidationUtils& utils) override;
|
||||
void ValidateEndTime(const Lazy<Timestamp>& lvalue, const ValidationUtils& utils) override;
|
||||
void ValidateDuration(const Lazy<Timestamp>& lvalue, const ValidationUtils& utils) override;
|
||||
|
||||
private:
|
||||
ObjectImpl<Checkable>::Ptr m_Checkable;
|
||||
|
|
|
|||
|
|
@ -89,6 +89,14 @@ void ScheduledDowntime::Start(bool runtimeCreated)
|
|||
Utility::QueueAsyncCallback([this]() { CreateNextDowntime(); });
|
||||
}
|
||||
|
||||
void ScheduledDowntime::ValidateDuration(const Lazy<Timestamp>& lvalue, const ValidationUtils& utils)
|
||||
{
|
||||
ObjectImpl<ScheduledDowntime>::ValidateDuration(lvalue, utils);
|
||||
|
||||
if (lvalue() < 0)
|
||||
BOOST_THROW_EXCEPTION(ValidationError(this, { "duration" }, "Duration must be positive."));
|
||||
}
|
||||
|
||||
void ScheduledDowntime::TimerProc()
|
||||
{
|
||||
for (const ScheduledDowntime::Ptr& sd : ConfigType::GetObjectsByType<ScheduledDowntime>()) {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public:
|
|||
protected:
|
||||
void OnAllConfigLoaded() override;
|
||||
void Start(bool runtimeCreated) override;
|
||||
void ValidateDuration(const Lazy<Timestamp>& lvalue, const ValidationUtils& utils) override;
|
||||
|
||||
private:
|
||||
static void TimerProc();
|
||||
|
|
|
|||
Loading…
Reference in a new issue