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