diff --git a/src/modules/netinstall/Config.cpp b/src/modules/netinstall/Config.cpp index 556cb1cf9..062518221 100644 --- a/src/modules/netinstall/Config.cpp +++ b/src/modules/netinstall/Config.cpp @@ -109,7 +109,7 @@ Config::receivedGroupData() cDebug() << "NetInstall group data received" << m_reply->size() << "bytes from" << m_reply->url(); - cqDeleter< QNetworkReply > d{ m_reply }; + cqDeleter< QNetworkReply > d { m_reply }; // If m_required is *false* then we still say we're ready // even if the reply is corrupt or missing. @@ -128,11 +128,23 @@ Config::receivedGroupData() { YAML::Node groups = YAML::Load( yamlData.constData() ); - if ( !groups.IsSequence() ) + if ( groups.IsSequence() ) + { + loadGroupList( CalamaresUtils::yamlSequenceToVariant( groups ) ); + } + else if ( groups.IsMap() ) + { + auto map = CalamaresUtils::yamlMapToVariant( groups ); + loadGroupList( map.value( "groups" ).toList() ); + } + else { cWarning() << "NetInstall groups data does not form a sequence."; } - loadGroupList( CalamaresUtils::yamlSequenceToVariant( groups ) ); + if ( m_model->rowCount() < 1 ) + { + cWarning() << "NetInstall groups data was empty."; + } } catch ( YAML::Exception& e ) { diff --git a/src/modules/netinstall/netinstall.conf b/src/modules/netinstall/netinstall.conf index a1496d6ff..7de577877 100644 --- a/src/modules/netinstall/netinstall.conf +++ b/src/modules/netinstall/netinstall.conf @@ -50,9 +50,11 @@ # # The format of the groups file is the same as the format of the # *groups* key described below, **except** that a stand-alone -# groups file does not have the top-level *groups* key. -# -# TODO: remove that ^^ restriction +# groups file does not have to have the top-level *groups* key. +# (It **may** have one, though, for instance when you copy +# this configuration file to `netinstall.yaml` and key *groups* +# must have a list-of-groups as value; if the file does not have +# a top-level key *groups*, then the file must contain only a list of groups. # # As a special case, setting *groupsUrl* to the literal string # `local` means that the data is obtained from **this** config @@ -118,9 +120,8 @@ label: # groups data is read from this file. The value of *groups* must be # a list. Each item in the list is a group (of packages, or subgroups, # or both). A standalone groups file contains just the list, -# without the top-level *groups* key. -# -# TODO: remove that restriction ^^ +# (without the top-level *groups* key, or just the top-level *groups* +# key and with the list as its value, like in this file). # # Using `local` is recommended only for small static package lists. # Here it is used for documentation purposes.