[libcalamares] Warn (python only) about unknown GS keys

This makes it easier to spot problems where key-names are mis-spelled
in Python (or other modules change a name and it's not applied
to consumers)
This commit is contained in:
Adriaan de Groot 2021-03-29 10:50:32 +02:00
parent b04d59ba2e
commit 0ccd55e33f

View File

@ -437,14 +437,24 @@ GlobalStoragePythonWrapper::keys() const
int
GlobalStoragePythonWrapper::remove( const std::string& key )
{
return m_gs->remove( QString::fromStdString( key ) );
const QString gsKey( QString::fromStdString( key ) );
if ( !m_gs->contains( gsKey ) )
{
cWarning() << "Unknown GS key" << key.c_str();
}
return m_gs->remove( gsKey );
}
bp::object
GlobalStoragePythonWrapper::value( const std::string& key ) const
{
return CalamaresPython::variantToPyObject( m_gs->value( QString::fromStdString( key ) ) );
const QString gsKey( QString::fromStdString( key ) );
if ( !m_gs->contains( gsKey ) )
{
cWarning() << "Unknown GS key" << key.c_str();
}
return CalamaresPython::variantToPyObject( m_gs->value( gsKey ) );
}
} // namespace CalamaresPython