mirror of https://github.com/Icinga/icinga2.git
Merge pull request #7891 from Icinga/bugfix/api-put-object-deletion-7726
ConfigObjectUtility#CreateObject(): check config objects for duplicates
This commit is contained in:
commit
769a899749
|
@ -152,12 +152,14 @@ bool ConfigObjectUtility::CreateObject(const Type::Ptr& type, const String& full
|
|||
{
|
||||
CreateStorage();
|
||||
|
||||
ConfigItem::Ptr item = ConfigItem::GetByTypeAndName(type, fullName);
|
||||
{
|
||||
auto configType (dynamic_cast<ConfigType*>(type.get()));
|
||||
|
||||
if (item) {
|
||||
if (configType && configType->GetObject(fullName)) {
|
||||
errors->Add("Object '" + fullName + "' already exists.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
String path;
|
||||
|
||||
|
|
Loading…
Reference in New Issue