]> granicus.if.org Git - icinga2/commitdiff
Make sure templates are never evaluated on their own
authorGunnar Beutner <gunnar@beutner.name>
Fri, 31 Oct 2014 16:52:47 +0000 (17:52 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Sat, 1 Nov 2014 04:12:13 +0000 (05:12 +0100)
fixes #7536

lib/cli/objectlistcommand.cpp
lib/config/configitem.cpp

index 69c9fb022c50d584406ee7bf3bdd82bca59dfea9..ce3775080091d864cdd62791e2f61fbb80e0dc5f 100644 (file)
@@ -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);
index 06a14cf276c14f5decf8fded487cc5edfbd9e516..5d51fd5cf351fd68bfe0fea3fad63f09090f4ea1 100644 (file)
@@ -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<Dictionary>();
 
                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());