From: Michael Friedrich Date: Thu, 17 Dec 2015 09:20:41 +0000 (+0100) Subject: Fix that "repository add" writes invalid "type" attribute X-Git-Tag: v2.5.0~645 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=af3458dfec41988d4aae1b5cb38736a51f5eb209;p=icinga2 Fix that "repository add" writes invalid "type" attribute fixes #10867 --- diff --git a/lib/cli/repositoryutility.cpp b/lib/cli/repositoryutility.cpp index bcbaf1070..9d548441d 100644 --- a/lib/cli/repositoryutility.cpp +++ b/lib/cli/repositoryutility.cpp @@ -233,12 +233,15 @@ bool RepositoryUtility::AddObject(const std::vector& object_paths, const if (check_config) { try { ConfigObject::Ptr object = static_pointer_cast(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(object)->Validate(FAConfig, utils); + + attrs->Remove("type"); } catch (const ValidationError& ex) { Log(LogCritical, "config", DiagnosticInformation(ex)); return false;