Warning in debug output when the RequirementsChecker is misconfigured.

CAL-390 #close
This commit is contained in:
Teo Mrnjavac 2016-09-16 10:52:42 +02:00
parent 1c3d5c67e9
commit 0c29233062
2 changed files with 25 additions and 0 deletions

View File

@ -20,6 +20,7 @@
#include "WelcomePage.h" #include "WelcomePage.h"
#include "checker/RequirementsChecker.h" #include "checker/RequirementsChecker.h"
#include "utils/Logger.h"
#include <QVariant> #include <QVariant>
@ -128,5 +129,8 @@ WelcomeViewStep::setConfigurationMap( const QVariantMap& configurationMap )
if ( configurationMap.contains( "requirements" ) && if ( configurationMap.contains( "requirements" ) &&
configurationMap.value( "requirements" ).type() == QVariant::Map ) configurationMap.value( "requirements" ).type() == QVariant::Map )
m_requirementsChecker->setConfigurationMap( configurationMap.value( "requirements" ).toMap() ); m_requirementsChecker->setConfigurationMap( configurationMap.value( "requirements" ).toMap() );
else
cDebug() << "WARNING: no valid requirements map found in welcome "
"module configuration.";
} }

View File

@ -185,6 +185,7 @@ RequirementsChecker::widget() const
void void
RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap ) RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap )
{ {
bool incompleteConfiguration = false;
if ( configurationMap.contains( "requiredStorage" ) && if ( configurationMap.contains( "requiredStorage" ) &&
( configurationMap.value( "requiredStorage" ).type() == QVariant::Double || ( configurationMap.value( "requiredStorage" ).type() == QVariant::Double ||
configurationMap.value( "requiredStorage" ).type() == QVariant::Int ) ) configurationMap.value( "requiredStorage" ).type() == QVariant::Int ) )
@ -199,6 +200,7 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap )
else else
{ {
m_requiredStorageGB = 3.; m_requiredStorageGB = 3.;
incompleteConfiguration = true;
} }
if ( configurationMap.contains( "requiredRam" ) && if ( configurationMap.contains( "requiredRam" ) &&
@ -208,11 +210,15 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap )
bool ok = false; bool ok = false;
m_requiredRamGB = configurationMap.value( "requiredRam" ).toDouble( &ok ); m_requiredRamGB = configurationMap.value( "requiredRam" ).toDouble( &ok );
if ( !ok ) if ( !ok )
{
m_requiredRamGB = 1.; m_requiredRamGB = 1.;
incompleteConfiguration = true;
}
} }
else else
{ {
m_requiredRamGB = 1.; m_requiredRamGB = 1.;
incompleteConfiguration = true;
} }
if ( configurationMap.contains( "check" ) && if ( configurationMap.contains( "check" ) &&
@ -221,6 +227,8 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap )
m_entriesToCheck.clear(); m_entriesToCheck.clear();
m_entriesToCheck.append( configurationMap.value( "check" ).toStringList() ); m_entriesToCheck.append( configurationMap.value( "check" ).toStringList() );
} }
else
incompleteConfiguration = true;
if ( configurationMap.contains( "required" ) && if ( configurationMap.contains( "required" ) &&
configurationMap.value( "required" ).type() == QVariant::List ) configurationMap.value( "required" ).type() == QVariant::List )
@ -228,6 +236,19 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap )
m_entriesToRequire.clear(); m_entriesToRequire.clear();
m_entriesToRequire.append( configurationMap.value( "required" ).toStringList() ); m_entriesToRequire.append( configurationMap.value( "required" ).toStringList() );
} }
else
incompleteConfiguration = true;
if ( incompleteConfiguration )
{
cDebug() << "WARNING: The RequirementsChecker configuration map provided by "
"the welcome module configuration file is incomplete or "
"incorrect.\n"
"Startup will continue for debugging purposes, but one or "
"more checks might not function correctly.\n"
"RequirementsChecker configuration map:\n"
<< configurationMap;
}
} }