mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-27 07:34:15 +02:00
Merge pull request #8788 from Icinga/bugfix/api-put-object-deletion-211-7726
ConfigObjectUtility#CreateObject(): check config objects for duplicates
This commit is contained in:
commit
ee21dc3f53
@ -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…
x
Reference in New Issue
Block a user