Bugfixes for the type validation feature.

This commit is contained in:
Gunnar Beutner 2013-02-02 19:56:23 +01:00
parent 33aba14197
commit 628d8374c7
3 changed files with 82 additions and 76 deletions

View File

@ -18,23 +18,23 @@
******************************************************************************/
type DynamicObject {
number __abstract,
number __local,
number __name,
number __type,
number __abstract,
number __local,
number __name,
number __type,
dictionary methods {
string *,
},
dictionary methods {
string *,
},
any custom::*
any custom::*
}
type Component {
}
type Logger {
string type,
string "type",
string path,
string severity
}
@ -71,7 +71,7 @@ type IcingaApplication {
string service,
string pid_path,
string state_path,
string macros
dictionary macros
}
type Service {
@ -104,5 +104,8 @@ type ServiceGroup {
type Endpoint {
string node,
string service,
number local
number "local"
}
type TimePeriod {
}

View File

@ -62,8 +62,8 @@ void ConfigType::ValidateObject(const DynamicObject::Ptr& object) const
continue;
if (!ValidateAttribute(it->first, it->second.Data))
Logger::Write(LogWarning, "base", "Configuration attribute '" + it->first +
"' on object '" + object->GetName() + "' of type '" + object->GetType()->GetName() + "' is unknown.");
Logger::Write(LogWarning, "config", "Configuration attribute '" + it->first +
"' on object '" + object->GetName() + "' of type '" + object->GetType()->GetName() + "' is unknown or contains an invalid type.");
}
}

View File

@ -36,6 +36,9 @@ bool TypeRule::Matches(const String& name, const Value& value) const
if (!Utility::Match(m_NamePattern, name))
return false;
if (value.IsEmpty())
return true;
switch (m_Type) {
case TypeAny:
return true;