[oemid] If the configuration is broken, complain loudly

- Adds an InvalidConfiguration value for internal errors

SEE #1136
main
Adriaan de Groot 6 years ago
parent e0a79f4c0f
commit 5f01a8ccc5

@ -40,7 +40,8 @@ public:
{ {
NoError = 0, NoError = 0,
GenericError = -1, GenericError = -1,
PythonUncaughtException = 1 PythonUncaughtException = 1,
InvalidConfiguration = 2
} ; } ;
JobResult( const JobResult& rhs ) = delete; JobResult( const JobResult& rhs ) = delete;

@ -82,13 +82,12 @@ Calamares::JobResult IDJob::exec()
QString targetFile = QStringLiteral( "oem-id" ); QString targetFile = QStringLiteral( "oem-id" );
QString rootMount = gs->value( "rootMountPoint" ).toString(); QString rootMount = gs->value( "rootMountPoint" ).toString();
static const char noRoot[] = "No rootMountPoint is set."; // Don't bother translating internal errors
static const char yesRoot[] = "rootMountPoint is set:";
QString targetPath;
if ( rootMount.isEmpty() && Calamares::Settings::instance()->doChroot() ) if ( rootMount.isEmpty() && Calamares::Settings::instance()->doChroot() )
cWarning() << Logger::SubEntry << noRoot; return Calamares::JobResult::internalError(
"OEM Batch Identifier",
"No rootMountPoint is set, but a chroot is required. "
"Is there a module before oemid that sets up the partitions?",
Calamares::JobResult::InvalidConfiguration );
return writeId( Calamares::Settings::instance()->doChroot() ? rootMount + targetDir : targetDir, targetFile, m_batchIdentifier ); return writeId( Calamares::Settings::instance()->doChroot() ? rootMount + targetDir : targetDir, targetFile, m_batchIdentifier );
} }

Loading…
Cancel
Save