[netinstall] Allow the netinstall.yaml to contain key *groups*
- This makes it easier to just copy the example, *groups*-key and all, into an online YAML file and serve that up. You get easier (local) testing.
This commit is contained in:
parent
2aca5464b7
commit
a4c5e18c4b
@ -109,7 +109,7 @@ Config::receivedGroupData()
|
|||||||
|
|
||||||
cDebug() << "NetInstall group data received" << m_reply->size() << "bytes from" << m_reply->url();
|
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
|
// If m_required is *false* then we still say we're ready
|
||||||
// even if the reply is corrupt or missing.
|
// even if the reply is corrupt or missing.
|
||||||
@ -128,11 +128,23 @@ Config::receivedGroupData()
|
|||||||
{
|
{
|
||||||
YAML::Node groups = YAML::Load( yamlData.constData() );
|
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.";
|
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 )
|
catch ( YAML::Exception& e )
|
||||||
{
|
{
|
||||||
|
@ -50,9 +50,11 @@
|
|||||||
#
|
#
|
||||||
# The format of the groups file is the same as the format of the
|
# The format of the groups file is the same as the format of the
|
||||||
# *groups* key described below, **except** that a stand-alone
|
# *groups* key described below, **except** that a stand-alone
|
||||||
# groups file does not have the top-level *groups* key.
|
# groups file does not have to have the top-level *groups* key.
|
||||||
#
|
# (It **may** have one, though, for instance when you copy
|
||||||
# TODO: remove that ^^ restriction
|
# 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
|
# As a special case, setting *groupsUrl* to the literal string
|
||||||
# `local` means that the data is obtained from **this** config
|
# `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
|
# 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,
|
# a list. Each item in the list is a group (of packages, or subgroups,
|
||||||
# or both). A standalone groups file contains just the list,
|
# or both). A standalone groups file contains just the list,
|
||||||
# without the top-level *groups* key.
|
# (without the top-level *groups* key, or just the top-level *groups*
|
||||||
#
|
# key and with the list as its value, like in this file).
|
||||||
# TODO: remove that restriction ^^
|
|
||||||
#
|
#
|
||||||
# Using `local` is recommended only for small static package lists.
|
# Using `local` is recommended only for small static package lists.
|
||||||
# Here it is used for documentation purposes.
|
# Here it is used for documentation purposes.
|
||||||
|
Loading…
Reference in New Issue
Block a user