[netinstall] Edge cases of zero, or unset, groups urls
- consumers may wait for loadingDone(), so always emit that even if no URL list is set.
This commit is contained in:
parent
9569105575
commit
4dd6ecd54e
@ -136,26 +136,23 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
// Lastly, load the groups data
|
// Lastly, load the groups data
|
||||||
const QString key = QStringLiteral( "groupsUrl" );
|
const QString key = QStringLiteral( "groupsUrl" );
|
||||||
const auto& groupsUrlVariant = configurationMap.value( key );
|
const auto& groupsUrlVariant = configurationMap.value( key );
|
||||||
|
m_queue = new LoaderQueue( this );
|
||||||
if ( groupsUrlVariant.type() == QVariant::String )
|
if ( groupsUrlVariant.type() == QVariant::String )
|
||||||
{
|
{
|
||||||
m_queue = new LoaderQueue( this );
|
|
||||||
m_queue->append( SourceItem::makeSourceItem( groupsUrlVariant.toString(), configurationMap ) );
|
m_queue->append( SourceItem::makeSourceItem( groupsUrlVariant.toString(), configurationMap ) );
|
||||||
}
|
}
|
||||||
else if ( groupsUrlVariant.type() == QVariant::List )
|
else if ( groupsUrlVariant.type() == QVariant::List )
|
||||||
{
|
{
|
||||||
m_queue = new LoaderQueue( this );
|
|
||||||
for ( const auto& s : groupsUrlVariant.toStringList() )
|
for ( const auto& s : groupsUrlVariant.toStringList() )
|
||||||
{
|
{
|
||||||
m_queue->append( SourceItem::makeSourceItem( s, configurationMap ) );
|
m_queue->append( SourceItem::makeSourceItem( s, configurationMap ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( m_queue && m_queue->count() > 0 )
|
|
||||||
{
|
setStatus( required() ? Status::FailedNoData : Status::Ok );
|
||||||
cDebug() << "Loading netinstall from" << m_queue->count() << "alternate sources.";
|
cDebug() << "Loading netinstall from" << m_queue->count() << "alternate sources.";
|
||||||
setStatus( required() ? Status::FailedNoData : Status::Ok );
|
connect( m_queue, &LoaderQueue::done, this, &Config::loadingDone );
|
||||||
connect( m_queue, &LoaderQueue::done, this, &Config::loadingDone );
|
m_queue->load();
|
||||||
m_queue->load();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -347,6 +347,7 @@ ItemTests::testUrlFallback_data()
|
|||||||
QTest::newRow( "error" ) << "1a-single-error.conf" << smash( S::FailedBadData ) << 0;
|
QTest::newRow( "error" ) << "1a-single-error.conf" << smash( S::FailedBadData ) << 0;
|
||||||
QTest::newRow( "second" ) << "1b-single-small.conf" << smash( S::Ok ) << 2;
|
QTest::newRow( "second" ) << "1b-single-small.conf" << smash( S::Ok ) << 2;
|
||||||
QTest::newRow( "none" ) << "1c-none.conf" << smash( S::FailedNoData ) << 0;
|
QTest::newRow( "none" ) << "1c-none.conf" << smash( S::FailedNoData ) << 0;
|
||||||
|
QTest::newRow( "unset" ) << "1c-unset.conf" << smash( S::FailedNoData ) << 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
5
src/modules/netinstall/tests/1c-unset.conf
Normal file
5
src/modules/netinstall/tests/1c-unset.conf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# SPDX-FileCopyrightText: no
|
||||||
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
#
|
||||||
|
---
|
||||||
|
required: true
|
Loading…
Reference in New Issue
Block a user