mirror of https://github.com/Icinga/icinga2.git
ConfigObjectUtility#CreateObject(): check config objects for duplicates
... not to delete already existing objects during a trial of re-creation. refs #7726
This commit is contained in:
parent
f7e368564f
commit
4051bc9c8f
|
@ -152,11 +152,13 @@ bool ConfigObjectUtility::CreateObject(const Type::Ptr& type, const String& full
|
||||||
{
|
{
|
||||||
CreateStorage();
|
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.");
|
errors->Add("Object '" + fullName + "' already exists.");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String path;
|
String path;
|
||||||
|
|
Loading…
Reference in New Issue