[libcalamares] Produce warnings while reading settings
- any invalid instance key will cause a complaint - "new" custom instances in sequence get a complaint, but the instance description added to the list is valid
This commit is contained in:
parent
a8075fba5f
commit
4cd2a4ae91
@ -169,7 +169,13 @@ interpretInstances( const YAML::Node& node, Settings::InstanceDescriptionList& c
|
||||
{
|
||||
continue;
|
||||
}
|
||||
customInstances.append( InstanceDescription::fromSettings( instancesVListItem.toMap() ) );
|
||||
auto description = InstanceDescription::fromSettings( instancesVListItem.toMap() );
|
||||
if ( !description.isValid() )
|
||||
{
|
||||
cWarning() << "Invalid entry in *instances*" << instancesVListItem;
|
||||
}
|
||||
// Append it **anyway**, since this will bail out after Settings is constructed
|
||||
customInstances.append( description );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -206,16 +212,22 @@ interpretSequence( const YAML::Node& node, Settings::ModuleSequence& moduleSeque
|
||||
}
|
||||
else
|
||||
{
|
||||
cDebug() << "Unknown action in *sequence*" << thisActionS;
|
||||
continue;
|
||||
}
|
||||
|
||||
QStringList thisActionRoster = sequenceVListItem.toMap().value( thisActionS ).toStringList();
|
||||
Calamares::ModuleSystem::InstanceKeyList roster;
|
||||
roster.reserve( thisActionRoster.count() );
|
||||
std::transform( thisActionRoster.constBegin(),
|
||||
thisActionRoster.constEnd(),
|
||||
std::back_inserter( roster ),
|
||||
[]( const QString& s ) { return Calamares::ModuleSystem::InstanceKey::fromString( s ); } );
|
||||
for ( const auto& s : thisActionRoster )
|
||||
{
|
||||
auto instanceKey = Calamares::ModuleSystem::InstanceKey::fromString( s );
|
||||
if ( !instanceKey.isValid() )
|
||||
{
|
||||
cWarning() << "Invalid instance in *sequence*" << s;
|
||||
}
|
||||
roster.append( instanceKey );
|
||||
}
|
||||
moduleSequence.append( qMakePair( thisAction, roster ) );
|
||||
}
|
||||
}
|
||||
@ -258,7 +270,7 @@ Settings::Settings( const QString& settingsFilePath, bool debugMode )
|
||||
}
|
||||
|
||||
void
|
||||
Settings::validateSequence()
|
||||
Settings::reconcileInstancesAndSequence()
|
||||
{
|
||||
// Since moduleFinder captures targetKey by reference, we can
|
||||
// update targetKey to change what the finder lambda looks for.
|
||||
@ -311,7 +323,7 @@ Settings::setConfiguration( const QByteArray& ba, const QString& explainName )
|
||||
m_disableCancelDuringExec = requireBool( config, "disable-cancel-during-exec", false );
|
||||
m_quitAtEnd = requireBool( config, "quit-at-end", false );
|
||||
|
||||
validateSequence();
|
||||
reconcileInstancesAndSequence();
|
||||
}
|
||||
catch ( YAML::Exception& e )
|
||||
{
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
explicit Settings( const QString& settingsFilePath, bool debugMode );
|
||||
|
||||
void setConfiguration( const QByteArray& configData, const QString& explainName );
|
||||
void validateSequence();
|
||||
void reconcileInstancesAndSequence();
|
||||
|
||||
public:
|
||||
static Settings* instance();
|
||||
|
Loading…
Reference in New Issue
Block a user