Set m_lastFailedUpdateStep (future use for downloading the firmware-device-controller).

This commit is contained in:
Gerhard Hoffmann 2024-01-19 08:27:07 +01:00
parent 1c0786e28c
commit 005e4d249f

View File

@ -164,6 +164,8 @@ Worker::Worker(int customerNr,
// TODO: turn object into singleton // TODO: turn object into singleton
instance = this; instance = this;
m_lastFailedUpdateStep = UPDATE_STEP::NONE;
this->setObjectName("worker-object"); this->setObjectName("worker-object");
QDir::setCurrent(m_workingDirectory); QDir::setCurrent(m_workingDirectory);
@ -283,12 +285,12 @@ void Worker::privateUpdate() {
if (isRepositoryCorrupted()) { // a not-existing repository is not meant if (isRepositoryCorrupted()) { // a not-existing repository is not meant
// to be corrupted // to be corrupted
CONSOLE() << UPDATE_STEP::CHECK_SANITY_FAILURE; CONSOLE() << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_SANITY_FAILURE);
if ((continueUpdate = repairCorruptedRepository()) == true) { if ((continueUpdate = repairCorruptedRepository()) == true) {
m_repairClone = true; m_repairClone = true;
CONSOLE() << UPDATE_STEP::REPOSITORY_RECOVERED_SUCCESS; CONSOLE() << UPDATE_STEP::REPOSITORY_RECOVERED_SUCCESS;
} else { } else {
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::REPOSITORY_RECOVERED_FAILURE)); ISMAS() << (GUI() << (CONSOLE() << (m_lastFailedUpdateStep = UPDATE_STEP::REPOSITORY_RECOVERED_FAILURE)));
return; return;
} }
} }
@ -316,7 +318,7 @@ void Worker::privateUpdate() {
} }
if (continueUpdate == false) { if (continueUpdate == false) {
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CLONE_REPOSITORY_FAILURE)); GUI() << (ISMAS() << (CONSOLE() << (m_lastFailedUpdateStep = UPDATE_STEP::CLONE_REPOSITORY_FAILURE)));
return; return;
} }
@ -330,7 +332,7 @@ void Worker::privateUpdate() {
CONSOLE() << UPDATE_STEP::CHECK_REPOSITORY; CONSOLE() << UPDATE_STEP::CHECK_REPOSITORY;
if (isRepositoryCorrupted()) { if (isRepositoryCorrupted()) {
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::CHECK_REPOSITORY_FAILURE)); ISMAS() << (GUI() << (CONSOLE() << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_REPOSITORY_FAILURE)));
return; return;
} }
} }
@ -521,12 +523,12 @@ bool Worker::updateTriggerSet() {
.arg(parseError.error) .arg(parseError.error)
.arg(parseError.errorString()) .arg(parseError.errorString())
.arg(parseError.offset)); .arg(parseError.offset));
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE); GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE));
break; break;
} }
if (!document.isObject()) { if (!document.isObject()) {
QStringList lst(QString("not a json-object %1").arg(result.value())); QStringList lst(QString("not a json-object %1").arg(result.value()));
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE); GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE));
break; break;
} }
@ -535,7 +537,7 @@ bool Worker::updateTriggerSet() {
// always look for an 'error' first // always look for an 'error' first
if (obj.contains("error")) { if (obj.contains("error")) {
QStringList lst(obj.value("error").toString()); QStringList lst(obj.value("error").toString());
CONSOLE(QStringList(lst)) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE; CONSOLE(QStringList(lst)) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
QThread::sleep(6); QThread::sleep(6);
continue; continue;
} }
@ -552,28 +554,28 @@ bool Worker::updateTriggerSet() {
if (customerNr != m_customerNr) { if (customerNr != m_customerNr) {
QStringList lst(QString("CUSTOMER-NR (%1) != LOCAL CUSTOMER-NR (%2)") QStringList lst(QString("CUSTOMER-NR (%1) != LOCAL CUSTOMER-NR (%2)")
.arg(customerNr).arg(m_customerNr)); .arg(customerNr).arg(m_customerNr));
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE); GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE));
break; break;
} }
if (machineNr != m_machineNr) { if (machineNr != m_machineNr) {
QStringList lst(QString("MACHINE-NR (%1) != LOCAL MACHINE-NR (%2)") QStringList lst(QString("MACHINE-NR (%1) != LOCAL MACHINE-NR (%2)")
.arg(machineNr).arg(m_machineNr)); .arg(machineNr).arg(m_machineNr));
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE); GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE));
break; break;
} }
} else { } else {
QStringList lst("Dev_ID DOES NOT CONTAIN Custom_ID AND/OR Device_ID"); QStringList lst("Dev_ID DOES NOT CONTAIN Custom_ID AND/OR Device_ID");
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE); GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE));
break; break;
} }
} else { } else {
QStringList lst("Dev_ID KEY NOT A JSON-OBJECT"); QStringList lst("Dev_ID KEY NOT A JSON-OBJECT");
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE); GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE));
break; break;
} }
} else { } else {
QStringList lst("Dev_ID KEY NOT AVAILABLE"); QStringList lst("Dev_ID KEY NOT AVAILABLE");
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE); GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE));
break; break;
} }
@ -593,7 +595,7 @@ bool Worker::updateTriggerSet() {
// if the customer repository has just been cloned // if the customer repository has just been cloned
break; // it is OK the ISMAS trigger might not be 'WAIT' break; // it is OK the ISMAS trigger might not be 'WAIT'
} else { } else {
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE); GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE));
} }
QThread::sleep(6); QThread::sleep(6);
continue; continue;
@ -603,28 +605,28 @@ bool Worker::updateTriggerSet() {
GUI() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE); GUI() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE);
} else { } else {
QStringList lst(QString("TRIGGER-VALUE=<%1> NOT 'WAIT'").arg(triggerValue)); QStringList lst(QString("TRIGGER-VALUE=<%1> NOT 'WAIT'").arg(triggerValue));
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE); GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE));
} }
break; break;
} }
} else { } else {
QStringList lst("TRG key not available"); QStringList lst("TRG key not available");
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE); GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE));
break; break;
} }
} else { } else {
QStringList lst("Fileupload not a json-object"); QStringList lst("Fileupload not a json-object");
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE); GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE));
break; break;
} }
} else { } else {
QStringList lst(QString("Fileupload not available")); QStringList lst(QString("Fileupload not available"));
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE); GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE));
break; break;
} }
} else { } else {
QStringList lst = QStringList(QString("no ISMAS response")); QStringList lst = QStringList(QString("no ISMAS response"));
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE); GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE));
QThread::sleep(6); QThread::sleep(6);
} }
} }
@ -632,7 +634,7 @@ bool Worker::updateTriggerSet() {
if (m_initialClone == false) { if (m_initialClone == false) {
if (!triggerValue.contains("WAIT", Qt::CaseInsensitive)) { if (!triggerValue.contains("WAIT", Qt::CaseInsensitive)) {
QStringList lst(QString("ISMAS_UPDATE-TRIGGER-NOT-SET-OR-WRONG: VALUE=(") + triggerValue + ")"); QStringList lst(QString("ISMAS_UPDATE-TRIGGER-NOT-SET-OR-WRONG: VALUE=(") + triggerValue + ")");
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)); ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
} }
} }
@ -650,11 +652,11 @@ bool Worker::customerEnvironment() {
return true; return true;
} else { } else {
QStringList lst(QString("CHECKOUT OF " + m_customerRepository + "FAILED")); QStringList lst(QString("CHECKOUT OF " + m_customerRepository + "FAILED"));
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECKOUT_BRANCH_FAILURE)); ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECKOUT_BRANCH_FAILURE)));
} }
} else {// cannot happen } else {// cannot happen
QStringList lst(QString(m_customerRepository + " DOES NOT EXIST")); QStringList lst(QString(m_customerRepository + " DOES NOT EXIST"));
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECKOUT_BRANCH_FAILURE)); ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECKOUT_BRANCH_FAILURE)));
} }
return false; return false;
@ -709,7 +711,7 @@ bool Worker::filesToUpdate() {
GUI(m_filesToUpdate) << (CONSOLE(m_filesToUpdate) << UPDATE_STEP::FILES_TO_UPDATE); GUI(m_filesToUpdate) << (CONSOLE(m_filesToUpdate) << UPDATE_STEP::FILES_TO_UPDATE);
setProgress(_FILES_TO_UPDATE); setProgress(_FILES_TO_UPDATE);
} else { } else {
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::UPDATE_REPOSITORY_FAILURE)); ISMAS() << (GUI() << (CONSOLE() << (m_lastFailedUpdateStep = UPDATE_STEP::UPDATE_REPOSITORY_FAILURE)));
return false; return false;
} }
@ -817,7 +819,7 @@ bool Worker::execOpkgCommands() {
} }
} else { } else {
m_displayIndex = 1; m_displayIndex = 1;
ISMAS(opkgErrorLst) << (GUI(opkgErrorLst) << (CONSOLE() << UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE)); ISMAS(opkgErrorLst) << (GUI(opkgErrorLst) << (CONSOLE() << (m_lastFailedUpdateStep = UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE)));
GUI() << UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE; GUI() << UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE;
setProgress(_EXEC_OPKG_COMMAND_FAILURE); setProgress(_EXEC_OPKG_COMMAND_FAILURE);
return false; return false;
@ -859,7 +861,7 @@ bool Worker::downloadFilesToPSAHardware() {
} }
return false; return false;
} else { } else {
CONSOLE(QStringList("NO FILES TO DOWNLOAD TO PSA-HW")) << UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE; CONSOLE(QStringList("NO FILES TO DOWNLOAD TO PSA-HW")) << (m_lastFailedUpdateStep = UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE);
setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE); setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE);
} }
} }
@ -947,7 +949,7 @@ bool Worker::syncCustomerRepositoryAndFS() {
} }
} }
} }
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE)); ISMAS() << (GUI() << (CONSOLE() << (m_lastFailedUpdateStep = UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE)));
setProgress(_SYNC_CUSTOMER_REPOSITORY_FAILURE); setProgress(_SYNC_CUSTOMER_REPOSITORY_FAILURE);
return false; return false;
} }