mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-30 09:04:35 +02:00
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
c6cf9c6279
commit
83eba2b316
@ -152,11 +152,13 @@ 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) {
|
||||
errors->Add("Object '" + fullName + "' already exists.");
|
||||
return false;
|
||||
if (configType && configType->GetObject(fullName)) {
|
||||
errors->Add("Object '" + fullName + "' already exists.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
String path;
|
||||
|
Loading…
x
Reference in New Issue
Block a user