mirror of https://github.com/Icinga/icinga2.git
parent
2156154ce4
commit
bc4cacfee9
|
@ -522,6 +522,16 @@ Value AExpression::OpObject(const AExpression* expr, const Dictionary::Ptr& loca
|
|||
|
||||
ConfigItemBuilder::Ptr item = make_shared<ConfigItemBuilder>(expr->m_DebugInfo);
|
||||
|
||||
String checkName = name;
|
||||
|
||||
if (!abstract) {
|
||||
const DynamicObjectNameHelper *nh = dynamic_cast<const DynamicObjectNameHelper *>(Type::GetByName(type));
|
||||
|
||||
if (nh)
|
||||
checkName = nh->MakeObjectName(name, Dictionary::Ptr());
|
||||
}
|
||||
|
||||
if (!checkName.IsEmpty()) {
|
||||
ConfigItem::Ptr oldItem = ConfigItem::GetObject(type, name);
|
||||
|
||||
if (oldItem) {
|
||||
|
@ -529,6 +539,7 @@ Value AExpression::OpObject(const AExpression* expr, const Dictionary::Ptr& loca
|
|||
msgbuf << "Object '" << name << "' of type '" << type << "' re-defined: " << expr->m_DebugInfo << "; previous definition: " << oldItem->GetDebugInfo();
|
||||
BOOST_THROW_EXCEPTION(ConfigError(msgbuf.str()) << errinfo_debuginfo(expr->m_DebugInfo));
|
||||
}
|
||||
}
|
||||
|
||||
item->SetType(type);
|
||||
|
||||
|
|
Loading…
Reference in New Issue