[welcome] Log where GeoIP information came from, if it's unusable
- This helps chase down broken GeoIP configurations, since you can check the URL and handler type shown in the log.
This commit is contained in:
parent
6183c4e2f4
commit
3967f6c5ae
@ -133,7 +133,7 @@ WelcomeViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
{
|
{
|
||||||
QString countryResult = f->future().result();
|
QString countryResult = f->future().result();
|
||||||
cDebug() << "GeoIP result for welcome=" << countryResult;
|
cDebug() << "GeoIP result for welcome=" << countryResult;
|
||||||
view->setCountry( countryResult );
|
view->setCountry( countryResult, h );
|
||||||
f->deleteLater();
|
f->deleteLater();
|
||||||
delete h;
|
delete h;
|
||||||
} );
|
} );
|
||||||
@ -156,12 +156,22 @@ WelcomeViewStep::checkRequirements()
|
|||||||
return m_requirementsChecker->checkRequirements();
|
return m_requirementsChecker->checkRequirements();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
logGeoIPHandler( CalamaresUtils::GeoIP::Handler* handler )
|
||||||
|
{
|
||||||
|
if ( handler )
|
||||||
|
{
|
||||||
|
cDebug() << Logger::SubEntry << "Obtained from" << handler->url() << " (" << static_cast<int>( handler->type() ) << handler->selector() << ')';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
WelcomeViewStep::setCountry( const QString& countryCode )
|
WelcomeViewStep::setCountry( const QString& countryCode, CalamaresUtils::GeoIP::Handler* handler )
|
||||||
{
|
{
|
||||||
if ( countryCode.length() != 2 )
|
if ( countryCode.length() != 2 )
|
||||||
{
|
{
|
||||||
cDebug() << "Unusable country code" << countryCode;
|
cDebug() << "Unusable country code" << countryCode;
|
||||||
|
logGeoIPHandler( handler );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,6 +179,7 @@ WelcomeViewStep::setCountry( const QString& countryCode )
|
|||||||
if ( c_l.first == QLocale::Country::AnyCountry )
|
if ( c_l.first == QLocale::Country::AnyCountry )
|
||||||
{
|
{
|
||||||
cDebug() << "Unusable country code" << countryCode;
|
cDebug() << "Unusable country code" << countryCode;
|
||||||
|
logGeoIPHandler( handler );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -32,6 +32,14 @@
|
|||||||
class WelcomePage;
|
class WelcomePage;
|
||||||
class GeneralRequirements;
|
class GeneralRequirements;
|
||||||
|
|
||||||
|
namespace CalamaresUtils
|
||||||
|
{
|
||||||
|
namespace GeoIP
|
||||||
|
{
|
||||||
|
class Handler;
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
|
||||||
class PLUGINDLLEXPORT WelcomeViewStep : public Calamares::ViewStep
|
class PLUGINDLLEXPORT WelcomeViewStep : public Calamares::ViewStep
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -57,9 +65,10 @@ public:
|
|||||||
/** @brief Sets the country that Calamares is running in.
|
/** @brief Sets the country that Calamares is running in.
|
||||||
*
|
*
|
||||||
* This (ideally) sets up language and locale settings that are right for
|
* This (ideally) sets up language and locale settings that are right for
|
||||||
* the given 2-letter country code.
|
* the given 2-letter country code. Uses the handler's information (if
|
||||||
|
* given) for error reporting.
|
||||||
*/
|
*/
|
||||||
void setCountry( const QString& );
|
void setCountry( const QString&, CalamaresUtils::GeoIP::Handler* handler );
|
||||||
|
|
||||||
Calamares::RequirementsList checkRequirements() override;
|
Calamares::RequirementsList checkRequirements() override;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user