mirror of https://github.com/Icinga/icinga2.git
parent
873e294158
commit
9f18211ada
|
@ -20,7 +20,6 @@
|
|||
#include "cli/repositoryutility.hpp"
|
||||
#include "cli/clicommand.hpp"
|
||||
#include "config/configtype.hpp"
|
||||
#include "config/configcompilercontext.hpp"
|
||||
#include "config/configcompiler.hpp"
|
||||
#include "base/logger.hpp"
|
||||
#include "base/application.hpp"
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "icinga/macroprocessor.hpp"
|
||||
#include "icinga/externalcommandprocessor.hpp"
|
||||
#include "icinga/compatutility.hpp"
|
||||
#include "config/configcompilercontext.hpp"
|
||||
#include "base/dynamictype.hpp"
|
||||
#include "base/objectlock.hpp"
|
||||
#include "base/logger.hpp"
|
||||
|
@ -571,7 +570,7 @@ void CompatLogger::ValidateRotationMethod(const String& location, const CompatLo
|
|||
if (rotation_method != "HOURLY" && rotation_method != "DAILY" &&
|
||||
rotation_method != "WEEKLY" && rotation_method != "MONTHLY" && rotation_method != "NONE") {
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " +
|
||||
location + ": Rotation method '" + rotation_method + "' is invalid.", GetDebugInfo()));
|
||||
location + ": Rotation method '" + rotation_method + "' is invalid.", object->GetDebugInfo()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
#include "config/configcompiler.hpp"
|
||||
#include "config/typerule.hpp"
|
||||
#include "config/configcompilercontext.hpp"
|
||||
#include "config/expression.hpp"
|
||||
|
||||
using namespace icinga;
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "config/i2-config.hpp"
|
||||
#include "config/configitembuilder.hpp"
|
||||
#include "config/configcompiler.hpp"
|
||||
#include "config/configcompilercontext.hpp"
|
||||
#include "config/typerule.hpp"
|
||||
#include "config/typerulelist.hpp"
|
||||
#include "config/expression.hpp"
|
||||
|
|
|
@ -21,26 +21,13 @@
|
|||
#define CONFIGCOMPILERCONTEXT_H
|
||||
|
||||
#include "config/i2-config.hpp"
|
||||
#include "base/debuginfo.hpp"
|
||||
#include "base/stdiostream.hpp"
|
||||
#include "base/dictionary.hpp"
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace icinga
|
||||
{
|
||||
|
||||
struct I2_CONFIG_API ConfigCompilerMessage
|
||||
{
|
||||
bool Error;
|
||||
String Text;
|
||||
DebugInfo Location;
|
||||
|
||||
ConfigCompilerMessage(bool error, const String& text, const DebugInfo& di)
|
||||
: Error(error), Text(text), Location(di)
|
||||
{ }
|
||||
};
|
||||
|
||||
/*
|
||||
* @ingroup config
|
||||
*/
|
||||
|
|
|
@ -216,7 +216,7 @@ DynamicObject::Ptr ConfigItem::Commit(bool discard)
|
|||
|
||||
ConfigType::Ptr ctype = ConfigType::GetByName(GetType());
|
||||
|
||||
if (ctype)
|
||||
if (ctype) {
|
||||
TypeRuleUtilities utils;
|
||||
ctype->ValidateItem(GetName(), dobj, GetDebugInfo(), &utils);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include "config/configtype.hpp"
|
||||
#include "config/configcompilercontext.hpp"
|
||||
#include "config/vmops.hpp"
|
||||
#include "base/objectlock.hpp"
|
||||
#include "base/convert.hpp"
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "icinga/icingaapplication.hpp"
|
||||
#include "icinga/host.hpp"
|
||||
#include "icinga/service.hpp"
|
||||
#include "config/configcompilercontext.hpp"
|
||||
#include "base/dynamictype.hpp"
|
||||
#include "base/convert.hpp"
|
||||
#include "base/objectlock.hpp"
|
||||
|
@ -30,6 +29,7 @@
|
|||
#include "base/initialize.hpp"
|
||||
#include "base/logger.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/exception.hpp"
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
using namespace icinga;
|
||||
|
@ -425,6 +425,6 @@ void DbConnection::ValidateFailoverTimeout(const String& location, const DbConne
|
|||
{
|
||||
if (object->GetFailoverTimeout() < 60) {
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " +
|
||||
location + ": Failover timeout minimum is 60s.", GetDebugInfo()));
|
||||
location + ": Failover timeout minimum is 60s.", object->GetDebugInfo()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include "icinga/checkable.hpp"
|
||||
#include "config/configcompilercontext.hpp"
|
||||
#include "base/objectlock.hpp"
|
||||
#include "base/utility.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/exception.hpp"
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/bind/apply.hpp>
|
||||
|
||||
|
@ -271,6 +271,6 @@ void Checkable::ValidateCheckInterval(const String& location, const Checkable::P
|
|||
{
|
||||
if (object->GetCheckInterval() <= 0) {
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " +
|
||||
location + ": check_interval must be greater than 0.", GetDebugInfo()));
|
||||
location + ": check_interval must be greater than 0.", object->GetDebugInfo()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "icinga/command.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "config/configcompilercontext.hpp"
|
||||
#include "base/exception.hpp"
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
|
@ -48,7 +48,7 @@ void Command::ValidateAttributes(const String& location, const Command::Ptr& obj
|
|||
{
|
||||
if (object->GetArguments() != Empty && !object->GetCommandLine().IsObjectType<Array>()) {
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " +
|
||||
location + ": Attribute 'command' must be an array if the 'arguments' attribute is set.", GetDebugInfo()));
|
||||
location + ": Attribute 'command' must be an array if the 'arguments' attribute is set.", object->GetDebugInfo()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "icinga/service.hpp"
|
||||
#include "config/configitembuilder.hpp"
|
||||
#include "config/applyrule.hpp"
|
||||
#include "config/configcompilercontext.hpp"
|
||||
#include "base/initialize.hpp"
|
||||
#include "base/dynamictype.hpp"
|
||||
#include "base/logger.hpp"
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
|
||||
#include "icinga/dependency.hpp"
|
||||
#include "icinga/service.hpp"
|
||||
#include "config/configcompilercontext.hpp"
|
||||
#include "base/logger.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/exception.hpp"
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
using namespace icinga;
|
||||
|
@ -209,11 +209,11 @@ void Dependency::ValidateFilters(const String& location, const Dependency::Ptr&
|
|||
|
||||
if (object->GetParentServiceName().IsEmpty() && (sfilter & ~(StateFilterUp | StateFilterDown)) != 0) {
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " +
|
||||
location + ": State filter is invalid for host dependency.", GetDebugInfo()));
|
||||
location + ": State filter is invalid for host dependency.", object->GetDebugInfo()));
|
||||
}
|
||||
|
||||
if (!object->GetParentServiceName().IsEmpty() && (sfilter & ~(StateFilterOK | StateFilterWarning | StateFilterCritical | StateFilterUnknown)) != 0) {
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " +
|
||||
location + ": State filter is invalid for service dependency.", GetDebugInfo()));
|
||||
location + ": State filter is invalid for service dependency.", object->GetDebugInfo()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "icinga/hostgroup.hpp"
|
||||
#include "icinga/pluginutility.hpp"
|
||||
#include "icinga/scheduleddowntime.hpp"
|
||||
#include "config/configcompilercontext.hpp"
|
||||
#include "base/exception.hpp"
|
||||
#include "base/objectlock.hpp"
|
||||
#include "base/convert.hpp"
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "icinga/service.hpp"
|
||||
#include "config/configitembuilder.hpp"
|
||||
#include "config/applyrule.hpp"
|
||||
#include "config/configcompilercontext.hpp"
|
||||
#include "base/initialize.hpp"
|
||||
#include "base/dynamictype.hpp"
|
||||
#include "base/logger.hpp"
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "icinga/notification.hpp"
|
||||
#include "icinga/notificationcommand.hpp"
|
||||
#include "icinga/service.hpp"
|
||||
#include "config/configcompilercontext.hpp"
|
||||
#include "base/objectlock.hpp"
|
||||
#include "base/logger.hpp"
|
||||
#include "base/utility.hpp"
|
||||
|
@ -502,12 +501,12 @@ void Notification::ValidateFilters(const String& location, const Notification::P
|
|||
|
||||
if (object->GetServiceName().IsEmpty() && (sfilter & ~(StateFilterUp | StateFilterDown)) != 0) {
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " +
|
||||
location + ": State filter is invalid.", GetDebugInfo()));
|
||||
location + ": State filter is invalid.", object->GetDebugInfo()));
|
||||
}
|
||||
|
||||
if (!object->GetServiceName().IsEmpty() && (sfilter & ~(StateFilterOK | StateFilterWarning | StateFilterCritical | StateFilterUnknown)) != 0) {
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " +
|
||||
location + ": State filter is invalid.", GetDebugInfo()));
|
||||
location + ": State filter is invalid.", object->GetDebugInfo()));
|
||||
}
|
||||
|
||||
int tfilter = FilterArrayToInt(object->GetTypes(), 0);
|
||||
|
@ -516,7 +515,7 @@ void Notification::ValidateFilters(const String& location, const Notification::P
|
|||
1 << NotificationCustom | 1 << NotificationAcknowledgement | 1 << NotificationProblem | 1 << NotificationRecovery |
|
||||
1 << NotificationFlappingStart | 1 << NotificationFlappingEnd)) != 0) {
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " +
|
||||
location + ": Type filter is invalid.", GetDebugInfo()));
|
||||
location + ": Type filter is invalid.", object->GetDebugInfo()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "icinga/service.hpp"
|
||||
#include "config/configitembuilder.hpp"
|
||||
#include "config/applyrule.hpp"
|
||||
#include "config/configcompilercontext.hpp"
|
||||
#include "base/initialize.hpp"
|
||||
#include "base/dynamictype.hpp"
|
||||
#include "base/logger.hpp"
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "icinga/service.hpp"
|
||||
#include "config/configitembuilder.hpp"
|
||||
#include "config/applyrule.hpp"
|
||||
#include "config/configcompilercontext.hpp"
|
||||
#include "base/initialize.hpp"
|
||||
#include "base/dynamictype.hpp"
|
||||
#include "base/logger.hpp"
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
#include "icinga/usergroup.hpp"
|
||||
#include "icinga/notification.hpp"
|
||||
#include "icinga/usergroup.hpp"
|
||||
#include "config/configcompilercontext.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/objectlock.hpp"
|
||||
#include "base/exception.hpp"
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
using namespace icinga;
|
||||
|
@ -101,22 +101,22 @@ TimePeriod::Ptr User::GetPeriod(void) const
|
|||
return TimePeriod::GetByName(GetPeriodRaw());
|
||||
}
|
||||
|
||||
void User::ValidateFilters(const String& location, const Dictionary::Ptr& attrs)
|
||||
void User::ValidateFilters(const String& location, const User::Ptr& object)
|
||||
{
|
||||
int sfilter = FilterArrayToInt(attrs->Get("states"), 0);
|
||||
int sfilter = FilterArrayToInt(object->GetStates(), 0);
|
||||
|
||||
if ((sfilter & ~(StateFilterUp | StateFilterDown | StateFilterOK | StateFilterWarning | StateFilterCritical | StateFilterUnknown)) != 0) {
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " +
|
||||
location + ": State filter is invalid.", GetDebugInfo()));
|
||||
location + ": State filter is invalid.", object->GetDebugInfo()));
|
||||
}
|
||||
|
||||
int tfilter = FilterArrayToInt(attrs->Get("types"), 0);
|
||||
int tfilter = FilterArrayToInt(object->GetTypes(), 0);
|
||||
|
||||
if ((tfilter & ~(1 << NotificationDowntimeStart | 1 << NotificationDowntimeEnd | 1 << NotificationDowntimeRemoved |
|
||||
1 << NotificationCustom | 1 << NotificationAcknowledgement | 1 << NotificationProblem | 1 << NotificationRecovery |
|
||||
1 << NotificationFlappingStart | 1 << NotificationFlappingEnd)) != 0) {
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " +
|
||||
location + ": Type filter is invalid.", GetDebugInfo()));
|
||||
location + ": Type filter is invalid.", object->GetDebugInfo()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
/* Notifications */
|
||||
TimePeriod::Ptr GetPeriod(void) const;
|
||||
|
||||
static void ValidateFilters(const String& location, const Dictionary::Ptr& attrs);
|
||||
static void ValidateFilters(const String& location, const User::Ptr& attrs);
|
||||
|
||||
bool GetEnableNotifications(void) const;
|
||||
void SetEnableNotifications(bool enabled, const MessageOrigin& origin = MessageOrigin());
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include "livestatus/livestatuslistener.hpp"
|
||||
#include "icinga/perfdatavalue.hpp"
|
||||
#include "config/configcompilercontext.hpp"
|
||||
#include "base/utility.hpp"
|
||||
#include "base/objectlock.hpp"
|
||||
#include "base/dynamictype.hpp"
|
||||
|
@ -189,6 +188,6 @@ void LivestatusListener::ValidateSocketType(const String& location, const Livest
|
|||
|
||||
if (socket_type != "unix" && socket_type != "tcp") {
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " +
|
||||
location + ": Socket type '" + socket_type + "' is invalid.", GetDebugInfo()));
|
||||
location + ": Socket type '" + socket_type + "' is invalid.", object->GetDebugInfo()));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue