[netinstall] Complain about bad config

- it's easy to miss a  in hidden subgroups and other complex
  groups configurations, so complain loudly.
This commit is contained in:
Adriaan de Groot 2020-10-14 01:41:16 +02:00
parent 5895f3fb71
commit f093789deb

View File

@ -10,6 +10,7 @@
#include "PackageModel.h" #include "PackageModel.h"
#include "utils/Logger.h"
#include "utils/Variant.h" #include "utils/Variant.h"
#include "utils/Yaml.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" ) ) 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(); QVariantList subgroups = groupMap.value( "subgroups" ).toList();
if ( !subgroups.isEmpty() ) if ( !subgroups.isEmpty() )
{ {
@ -257,6 +270,13 @@ PackageModel::setupModelData( const QVariantList& groupList, PackageTreeItem* pa
// the checked-state -- do it manually. // the checked-state -- do it manually.
item->updateSelected(); item->updateSelected();
} }
else
{
if ( !haveWarned )
{
cWarning() << "*subgroups* list under" << item->name() << "is empty.";
}
}
} }
if ( item->isHidden() ) if ( item->isHidden() )
{ {