Fix that "repository add" writes invalid "type" attribute

fixes #10867
This commit is contained in:
Michael Friedrich 2015-12-17 10:20:41 +01:00
parent 8b6d3350b8
commit af3458dfec
1 changed files with 3 additions and 0 deletions

View File

@ -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;