mirror of
https://github.com/Icinga/icinga2.git
synced 2026-02-03 20:40:17 -05:00
Merge ed5a9ea103 into 274a0e39d5
This commit is contained in:
commit
f78a46ed39
4 changed files with 18 additions and 0 deletions
|
|
@ -583,6 +583,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")
|
||||
|
|
|
|||
|
|
@ -83,6 +83,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;
|
||||
|
|
|
|||
|
|
@ -88,6 +88,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>()) {
|
||||
|
|
|
|||
|
|
@ -40,6 +40,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