/******************************************************************************
* Icinga 2 *
- * Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/) *
+ * Copyright (C) 2012-2018 Icinga Development Team (https://icinga.com/) *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
if (endpoint) {
Zone::Ptr checkableZone = static_pointer_cast<Zone>(GetZone());
- if (!checkableZone)
- checkableZone = Zone::GetLocalZone();
+ if (checkableZone) {
+ Zone::Ptr cmdZone = endpoint->GetZone();
- Zone::Ptr cmdZone = endpoint->GetZone();
-
- if (checkableZone && cmdZone != checkableZone && cmdZone->GetParent() != checkableZone) {
+ if (cmdZone != checkableZone && cmdZone->GetParent() != checkableZone) {
+ BOOST_THROW_EXCEPTION(ValidationError(this, { "command_endpoint" },
+ "Command endpoint must be in zone '" + checkableZone->GetName() + "' or in a direct child zone thereof."));
+ }
+ } else {
BOOST_THROW_EXCEPTION(ValidationError(this, { "command_endpoint" },
- "Command endpoint must be in zone '" + checkableZone->GetName() + "' or in a direct child zone thereof."));
+ "Command endpoint must not be set."));
}
}
}
BOOST_THROW_EXCEPTION(ValidationError(this, { "check_interval" }, "Interval must be greater than 0."));
}
+void Checkable::ValidateRetryInterval(const Lazy<double>& lvalue, const ValidationUtils& utils)
+{
+ ObjectImpl<Checkable>::ValidateRetryInterval(lvalue, utils);
+
+ if (lvalue() <= 0)
+ BOOST_THROW_EXCEPTION(ValidationError(this, { "retry_interval" }, "Interval must be greater than 0."));
+}
+
void Checkable::ValidateMaxCheckAttempts(const Lazy<int>& lvalue, const ValidationUtils& utils)
{
ObjectImpl<Checkable>::ValidateMaxCheckAttempts(lvalue, utils);