From 98375df4d7994ed4b8be47b3136e87f9b09137e0 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 9 Dec 2014 14:55:29 +0100 Subject: [PATCH] Fix config validation in RepositoryUtility::AddObject refs #7701 --- lib/cli/repositoryutility.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/cli/repositoryutility.cpp b/lib/cli/repositoryutility.cpp index d2a36bb66..d8207635c 100644 --- a/lib/cli/repositoryutility.cpp +++ b/lib/cli/repositoryutility.cpp @@ -33,6 +33,7 @@ #include "base/debug.hpp" #include "base/objectlock.hpp" #include "base/console.hpp" +#include "base/serializer.hpp" #include #include #include @@ -246,8 +247,13 @@ bool RepositoryUtility::AddObject(const String& name, const String& type, const vattrs->Remove("import"); vattrs->Set("type", type); + Type::Ptr dtype = Type::GetByName(type); + + Object::Ptr object = dtype->Instantiate(); + Deserialize(object, vattrs, false, FAConfig); + RepositoryTypeRuleUtilities utils; - ctype->ValidateItem(name, vattrs, DebugInfo(), &utils); + ctype->ValidateItem(name, object, DebugInfo(), &utils); int warnings = 0, errors = 0;