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
instance = this;
m_lastFailedUpdateStep = UPDATE_STEP::NONE;
this->setObjectName("worker-object");
QDir::setCurrent(m_workingDirectory);
@ -283,12 +285,12 @@ void Worker::privateUpdate() {
if (isRepositoryCorrupted()) { // a not-existing repository is not meant
// to be corrupted
CONSOLE() << UPDATE_STEP::CHECK_SANITY_FAILURE;
CONSOLE() << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_SANITY_FAILURE);
if ((continueUpdate = repairCorruptedRepository()) == true) {
m_repairClone = true;
CONSOLE() << UPDATE_STEP::REPOSITORY_RECOVERED_SUCCESS;
} else {
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::REPOSITORY_RECOVERED_FAILURE));
ISMAS() << (GUI() << (CONSOLE() << (m_lastFailedUpdateStep = UPDATE_STEP::REPOSITORY_RECOVERED_FAILURE)));
return;
}
}
@ -316,7 +318,7 @@ void Worker::privateUpdate() {
}
if (continueUpdate == false) {
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CLONE_REPOSITORY_FAILURE));
GUI() << (ISMAS() << (CONSOLE() << (m_lastFailedUpdateStep = UPDATE_STEP::CLONE_REPOSITORY_FAILURE)));
return;
}
@ -330,7 +332,7 @@ void Worker::privateUpdate() {
CONSOLE() << UPDATE_STEP::CHECK_REPOSITORY;
if (isRepositoryCorrupted()) {
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::CHECK_REPOSITORY_FAILURE));
ISMAS() << (GUI() << (CONSOLE() << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_REPOSITORY_FAILURE)));
return;
}
}
@ -521,12 +523,12 @@ bool Worker::updateTriggerSet() {
.arg(parseError.error)
.arg(parseError.errorString())
.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;
}
if (!document.isObject()) {
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;
}
@ -535,7 +537,7 @@ bool Worker::updateTriggerSet() {
// always look for an 'error' first
if (obj.contains("error")) {
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);
continue;
}
@ -552,28 +554,28 @@ bool Worker::updateTriggerSet() {
if (customerNr != m_customerNr) {
QStringList lst(QString("CUSTOMER-NR (%1) != LOCAL CUSTOMER-NR (%2)")
.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;
}
if (machineNr != m_machineNr) {
QStringList lst(QString("MACHINE-NR (%1) != LOCAL MACHINE-NR (%2)")
.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;
}
} else {
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;
}
} else {
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;
}
} else {
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;
}
@ -593,7 +595,7 @@ bool Worker::updateTriggerSet() {
// if the customer repository has just been cloned
break; // it is OK the ISMAS trigger might not be 'WAIT'
} 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);
continue;
@ -603,28 +605,28 @@ bool Worker::updateTriggerSet() {
GUI() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE);
} else {
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;
}
} else {
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;
}
} else {
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;
}
} else {
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;
}
} else {
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);
}
}
@ -632,7 +634,7 @@ bool Worker::updateTriggerSet() {
if (m_initialClone == false) {
if (!triggerValue.contains("WAIT", Qt::CaseInsensitive)) {
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;
} else {
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
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;
@ -709,7 +711,7 @@ bool Worker::filesToUpdate() {
GUI(m_filesToUpdate) << (CONSOLE(m_filesToUpdate) << UPDATE_STEP::FILES_TO_UPDATE);
setProgress(_FILES_TO_UPDATE);
} else {
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::UPDATE_REPOSITORY_FAILURE));
ISMAS() << (GUI() << (CONSOLE() << (m_lastFailedUpdateStep = UPDATE_STEP::UPDATE_REPOSITORY_FAILURE)));
return false;
}
@ -817,7 +819,7 @@ bool Worker::execOpkgCommands() {
}
} else {
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;
setProgress(_EXEC_OPKG_COMMAND_FAILURE);
return false;
@ -859,7 +861,7 @@ bool Worker::downloadFilesToPSAHardware() {
}
return false;
} 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);
}
}
@ -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);
return false;
}