From: Gunnar Beutner Date: Fri, 31 Oct 2014 16:52:47 +0000 (+0100) Subject: Make sure templates are never evaluated on their own X-Git-Tag: v2.2.0~154 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1811f8689bd708ea55cba009799ffe9c054ff520;p=icinga2 Make sure templates are never evaluated on their own fixes #7536 --- diff --git a/lib/cli/objectlistcommand.cpp b/lib/cli/objectlistcommand.cpp index 69c9fb022..ce3775080 100644 --- a/lib/cli/objectlistcommand.cpp +++ b/lib/cli/objectlistcommand.cpp @@ -134,15 +134,9 @@ void ObjectListCommand::PrintObject(std::ostream& fp, bool& first, const String& else fp << "\n"; - bool abstract = object->Get("abstract"); Dictionary::Ptr debug_hints = object->Get("debug_hints"); - if (abstract) - fp << "Template '"; - else - fp << "Object '"; - - fp << ConsoleColorTag(Console_ForegroundBlue | Console_Bold) << internal_name << ConsoleColorTag(Console_Normal) << "'"; + fp << "Object " << ConsoleColorTag(Console_ForegroundBlue | Console_Bold) << internal_name << ConsoleColorTag(Console_Normal) << "'"; fp << " of type '" << ConsoleColorTag(Console_ForegroundMagenta | Console_Bold) << type << ConsoleColorTag(Console_Normal) << "':\n"; PrintProperties(fp, properties, debug_hints, 2); diff --git a/lib/config/configitem.cpp b/lib/config/configitem.cpp index 06a14cf27..5d51fd5cf 100644 --- a/lib/config/configitem.cpp +++ b/lib/config/configitem.cpp @@ -121,6 +121,7 @@ Expression::Ptr ConfigItem::GetExpressionList(void) const Dictionary::Ptr ConfigItem::GetProperties(void) { ASSERT(!OwnsLock()); + VERIFY(!IsAbstract()); ObjectLock olock(this); @@ -296,11 +297,13 @@ void ConfigItem::WriteObjectsFile(const String& filename) BOOST_FOREACH(const ItemMap::value_type& kv, m_Items) { ConfigItem::Ptr item = kv.second; + if (item->IsAbstract()) + continue; + Dictionary::Ptr persistentItem = make_shared(); persistentItem->Set("type", item->GetType()); persistentItem->Set("name", item->GetName()); - persistentItem->Set("abstract", item->IsAbstract()); persistentItem->Set("properties", item->GetProperties()); persistentItem->Set("debug_hints", item->GetDebugHints());