From f093789deb500b0a62739a4de7052944575e013e Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 14 Oct 2020 01:41:16 +0200 Subject: [PATCH] [netinstall] Complain about bad config - it's easy to miss a in hidden subgroups and other complex groups configurations, so complain loudly. --- src/modules/netinstall/PackageModel.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/modules/netinstall/PackageModel.cpp b/src/modules/netinstall/PackageModel.cpp index beb094d2d..7c97aead2 100644 --- a/src/modules/netinstall/PackageModel.cpp +++ b/src/modules/netinstall/PackageModel.cpp @@ -10,6 +10,7 @@ #include "PackageModel.h" +#include "utils/Logger.h" #include "utils/Variant.h" #include "utils/Yaml.h" @@ -245,9 +246,21 @@ PackageModel::setupModelData( const QVariantList& groupList, PackageTreeItem* pa } } } + if ( !item->childCount() ) + { + cWarning() << "*packages* under" << item->name() << "is empty."; + } } if ( groupMap.contains( "subgroups" ) ) { + bool haveWarned = false; + const auto& subgroupValue = groupMap.value( "subgroups" ); + if ( !subgroupValue.canConvert( QVariant::List ) ) + { + cWarning() << "*subgroups* under" << item->name() << "is not a list."; + haveWarned = true; + } + QVariantList subgroups = groupMap.value( "subgroups" ).toList(); if ( !subgroups.isEmpty() ) { @@ -257,6 +270,13 @@ PackageModel::setupModelData( const QVariantList& groupList, PackageTreeItem* pa // the checked-state -- do it manually. item->updateSelected(); } + else + { + if ( !haveWarned ) + { + cWarning() << "*subgroups* list under" << item->name() << "is empty."; + } + } } if ( item->isHidden() ) {