mirror of https://github.com/Icinga/icinga2.git
parent
8b6d3350b8
commit
af3458dfec
|
@ -233,12 +233,15 @@ bool RepositoryUtility::AddObject(const std::vector<String>& object_paths, const
|
|||
if (check_config) {
|
||||
try {
|
||||
ConfigObject::Ptr object = static_pointer_cast<ConfigObject>(utype->Instantiate());
|
||||
/* temporarly set the object type for validation */
|
||||
attrs->Set("type", utype->GetName());
|
||||
Deserialize(object, attrs, false, FAConfig);
|
||||
object->SetName(name);
|
||||
|
||||
RepositoryValidationUtils utils;
|
||||
static_pointer_cast<ConfigObject>(object)->Validate(FAConfig, utils);
|
||||
|
||||
attrs->Remove("type");
|
||||
} catch (const ValidationError& ex) {
|
||||
Log(LogCritical, "config", DiagnosticInformation(ex));
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue