Improve output, esecially to ISMAS

This commit is contained in:
Gerhard Hoffmann 2024-01-23 15:31:12 +01:00
parent 0a43654f9b
commit 9a9480035b

View File

@ -96,6 +96,7 @@ const QMap<UPDATE_STEP, const char*> Worker::smap (
INSERT_ELEMENT(UPDATE_STEP::SAVE_LOGS_SUCCESS), INSERT_ELEMENT(UPDATE_STEP::SAVE_LOGS_SUCCESS),
INSERT_ELEMENT(UPDATE_STEP::SAVE_LOGS_FAILURE), INSERT_ELEMENT(UPDATE_STEP::SAVE_LOGS_FAILURE),
INSERT_ELEMENT(UPDATE_STEP::SEND_LAST_VERSION), INSERT_ELEMENT(UPDATE_STEP::SEND_LAST_VERSION),
INSERT_ELEMENT(UPDATE_STEP::UPDATE_FINALIZE),
INSERT_ELEMENT(UPDATE_STEP::UPDATE_SUCCEEDED), INSERT_ELEMENT(UPDATE_STEP::UPDATE_SUCCEEDED),
INSERT_ELEMENT(UPDATE_STEP::UPDATE_NOT_NECESSARY), INSERT_ELEMENT(UPDATE_STEP::UPDATE_NOT_NECESSARY),
INSERT_ELEMENT(UPDATE_STEP::UPDATE_FAILED), INSERT_ELEMENT(UPDATE_STEP::UPDATE_FAILED),
@ -259,6 +260,7 @@ void Worker::privateUpdate() {
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::STARTED)); GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::STARTED));
QScopedPointer<UpdateProcessRunning> upr(new UpdateProcessRunning(this)); QScopedPointer<UpdateProcessRunning> upr(new UpdateProcessRunning(this));
QStringList lst;
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// //
@ -411,7 +413,8 @@ void Worker::privateUpdate() {
if ((continueUpdate = customerEnvironment()) == false) { if ((continueUpdate = customerEnvironment()) == false) {
return; return;
} }
CONSOLE() << UPDATE_STEP::CHECKOUT_BRANCH_SUCCESS; lst = QStringList(QString(smap[UPDATE_STEP::CHECKOUT_BRANCH_SUCCESS]));
ISMAS(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECKOUT_BRANCH);
setProgress(_CHECKOUT_BRANCH_SUCCESS); setProgress(_CHECKOUT_BRANCH_SUCCESS);
@ -423,7 +426,8 @@ void Worker::privateUpdate() {
if ((continueUpdate = filesToUpdate()) == false) { if ((continueUpdate = filesToUpdate()) == false) {
return; return;
} }
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::UPDATE_REPOSITORY_SUCCESS)); lst = QStringList(QString(smap[UPDATE_STEP::UPDATE_REPOSITORY_SUCCESS]));
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::UPDATE_REPOSITORY));
setProgress(_UPDATE_REPOSITORY_SUCCESS); setProgress(_UPDATE_REPOSITORY_SUCCESS);
@ -435,7 +439,8 @@ void Worker::privateUpdate() {
if ((continueUpdate = execOpkgCommands()) == false) { if ((continueUpdate = execOpkgCommands()) == false) {
return; return;
} }
GUI() << (CONSOLE() << UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS); lst = QStringList(QString(smap[UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS]));
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::EXEC_OPKG_COMMANDS);
setProgress(_EXEC_OPKG_COMMAND_SUCCESS); setProgress(_EXEC_OPKG_COMMAND_SUCCESS);
@ -447,7 +452,8 @@ void Worker::privateUpdate() {
if ((continueUpdate = downloadFilesToPSAHardware()) == false) { if ((continueUpdate = downloadFilesToPSAHardware()) == false) {
return; return;
} }
GUI() << (CONSOLE() << UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS); lst = QStringList(QString(smap[UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS]));
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE));
setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS); setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS);
@ -459,10 +465,10 @@ void Worker::privateUpdate() {
if ((continueUpdate = syncCustomerRepositoryAndFS()) == false) { if ((continueUpdate = syncCustomerRepositoryAndFS()) == false) {
return; return;
} }
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS)); lst = QStringList(QString(smap[UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS]));
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS));
setProgress(_SYNC_CUSTOMER_REPOSITORY_SUCCESS); setProgress(_SYNC_CUSTOMER_REPOSITORY_SUCCESS);
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// //
// FUTURE: SAVE LOG FILES // FUTURE: SAVE LOG FILES
@ -532,13 +538,13 @@ bool Worker::updateTriggerSet() {
.arg(parseError.errorString()) .arg(parseError.errorString())
.arg(parseError.offset)); .arg(parseError.offset));
QStringList lst = m_ismasTriggerStatusMessage; QStringList lst = m_ismasTriggerStatusMessage;
GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)); ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
return false; return false;
} }
if (!document.isObject()) { if (!document.isObject()) {
m_ismasTriggerStatusMessage = QStringList(QString("not a json-object %1").arg(result.value())); m_ismasTriggerStatusMessage = QStringList(QString("not a json-object %1").arg(result.value()));
QStringList lst = m_ismasTriggerStatusMessage; QStringList lst = m_ismasTriggerStatusMessage;
GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)); ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
return false; return false;
} }
@ -566,31 +572,31 @@ bool Worker::updateTriggerSet() {
m_ismasTriggerStatusMessage = QStringList(QString("CUSTOMER-NR (%1) != LOCAL CUSTOMER-NR (%2)") m_ismasTriggerStatusMessage = QStringList(QString("CUSTOMER-NR (%1) != LOCAL CUSTOMER-NR (%2)")
.arg(customerNr).arg(m_customerNr)); .arg(customerNr).arg(m_customerNr));
QStringList lst = m_ismasTriggerStatusMessage; QStringList lst = m_ismasTriggerStatusMessage;
GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)); ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
return false; return false;
} }
if (machineNr != m_machineNr) { if (machineNr != m_machineNr) {
m_ismasTriggerStatusMessage = QStringList(QString("MACHINE-NR (%1) != LOCAL MACHINE-NR (%2)") m_ismasTriggerStatusMessage = QStringList(QString("MACHINE-NR (%1) != LOCAL MACHINE-NR (%2)")
.arg(machineNr).arg(m_machineNr)); .arg(machineNr).arg(m_machineNr));
QStringList lst = m_ismasTriggerStatusMessage; QStringList lst = m_ismasTriggerStatusMessage;
GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)); ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
return false; return false;
} }
} else { } else {
QStringList lst(QString("Dev_ID DOES NOT CONTAIN Custom_ID AND/OR Device_ID (LINE=%1)").arg(__LINE__)); QStringList lst(QString("Dev_ID DOES NOT CONTAIN Custom_ID AND/OR Device_ID (LINE=%1)").arg(__LINE__));
GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)); ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
return false; return false;
} }
} else { } else {
m_ismasTriggerStatusMessage = QStringList(QString("Dev_ID KEY NOT A JSON-OBJECT (LINE=%1)").arg(__LINE__)); m_ismasTriggerStatusMessage = QStringList(QString("Dev_ID KEY NOT A JSON-OBJECT (LINE=%1)").arg(__LINE__));
QStringList lst = m_ismasTriggerStatusMessage; QStringList lst = m_ismasTriggerStatusMessage;
GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)); ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
return false; return false;
} }
} else { } else {
m_ismasTriggerStatusMessage = QStringList(QString("Dev_ID KEY NOT AVAILABLE (LINE=%1)").arg(__LINE__)); m_ismasTriggerStatusMessage = QStringList(QString("Dev_ID KEY NOT AVAILABLE (LINE=%1)").arg(__LINE__));
QStringList lst = m_ismasTriggerStatusMessage; QStringList lst = m_ismasTriggerStatusMessage;
GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)); ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
return false; return false;
} }
@ -608,7 +614,7 @@ bool Worker::updateTriggerSet() {
m_ismasTriggerStatusMessage = QStringList(QString("%1 EMPTY UPDATE TRIGGER (%2)").arg(repeat).arg(repeats-repeat)); m_ismasTriggerStatusMessage = QStringList(QString("%1 EMPTY UPDATE TRIGGER (%2)").arg(repeat).arg(repeats-repeat));
QStringList lst = m_ismasTriggerStatusMessage; QStringList lst = m_ismasTriggerStatusMessage;
if (m_clone) { if (m_clone) {
GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE)); ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE)));
// if the customer repository has just been cloned // if the customer repository has just been cloned
return false; // it is OK the ISMAS trigger might not be 'WAIT' return false; // it is OK the ISMAS trigger might not be 'WAIT'
} else { } else {
@ -619,32 +625,32 @@ bool Worker::updateTriggerSet() {
} else { } else {
// if the download-button once has a wrong value, it will never recover // if the download-button once has a wrong value, it will never recover
if (m_clone) { if (m_clone) {
m_ismasTriggerStatusMessage = QStringList(QString("TRIGGER-VALUE=<%1> NOT 'WAIT'").arg(triggerValue)); m_ismasTriggerStatusMessage = QStringList(QString("TRIGGER-VALUE='%1' != 'WAIT'").arg(triggerValue));
QStringList lst = m_ismasTriggerStatusMessage; QStringList lst = m_ismasTriggerStatusMessage;
GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE)); ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE)));
} else { } else {
m_ismasTriggerStatusMessage = QStringList(QString("TRIGGER-VALUE=<%1> NOT 'WAIT'").arg(triggerValue)); m_ismasTriggerStatusMessage = QStringList(QString("TRIGGER-VALUE='%1' != 'WAIT'").arg(triggerValue));
QStringList lst = m_ismasTriggerStatusMessage; QStringList lst = m_ismasTriggerStatusMessage;
GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)); ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
} }
return false; return false;
} }
} else { } else {
m_ismasTriggerStatusMessage = QStringList(QString("TRG key not available (LINE=%1)").arg(__LINE__)); m_ismasTriggerStatusMessage = QStringList(QString("TRG key not available (LINE=%1)").arg(__LINE__));
QStringList lst = m_ismasTriggerStatusMessage; QStringList lst = m_ismasTriggerStatusMessage;
GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)); ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
return false; return false;
} }
} else { } else {
m_ismasTriggerStatusMessage = QStringList(QString("Fileupload not a json-object (LINE=%1)").arg(__LINE__)); m_ismasTriggerStatusMessage = QStringList(QString("Fileupload not a json-object (LINE=%1)").arg(__LINE__));
QStringList lst = m_ismasTriggerStatusMessage; QStringList lst = m_ismasTriggerStatusMessage;
GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)); ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
return false; return false;
} }
} else { } else {
m_ismasTriggerStatusMessage = QStringList(QString("Fileupload not available (LINE=%1)").arg(__LINE__)); m_ismasTriggerStatusMessage = QStringList(QString("Fileupload not available (LINE=%1)").arg(__LINE__));
QStringList lst = m_ismasTriggerStatusMessage; QStringList lst = m_ismasTriggerStatusMessage;
GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)); ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
return false; return false;
} }
} else { } else {
@ -660,7 +666,7 @@ bool Worker::updateTriggerSet() {
if (!triggerValue.contains("WAIT", Qt::CaseInsensitive)) { if (!triggerValue.contains("WAIT", Qt::CaseInsensitive)) {
m_ismasTriggerStatusMessage = QStringList(QString("ISMAS_UPDATE-TRIGGER-NOT-SET-OR-WRONG: VALUE=(") + triggerValue + ")"); m_ismasTriggerStatusMessage = QStringList(QString("ISMAS_UPDATE-TRIGGER-NOT-SET-OR-WRONG: VALUE=(") + triggerValue + ")");
QStringList lst = m_ismasTriggerStatusMessage; QStringList lst = m_ismasTriggerStatusMessage;
GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)); ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
return false; return false;
} }
} }
@ -866,8 +872,9 @@ bool Worker::downloadFilesToPSAHardware() {
setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE); setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE);
if (m_noUpdatePsaHardware == false) { if (m_noUpdatePsaHardware == false) {
if (computeFilesToDownload()) { if (computeFilesToDownload() > 0) {
CONSOLE(m_filesToDownload) << UPDATE_STEP::FILES_TO_DOWNLOAD; QStringList lst = m_filesToDownload;
ISMAS(lst) << (CONSOLE(lst) << UPDATE_STEP::FILES_TO_DOWNLOAD);
Update update(this, Update update(this,
QDir::cleanPath(m_workingDirectory + QDir::separator() + m_customerNrStr), QDir::cleanPath(m_workingDirectory + QDir::separator() + m_customerNrStr),
@ -886,10 +893,11 @@ bool Worker::downloadFilesToPSAHardware() {
return true; return true;
} }
return false;
} else {
CONSOLE(QStringList("NO FILES TO DOWNLOAD TO PSA-HW")) << (m_lastFailedUpdateStep = 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);
return false;
} }
} }
@ -969,7 +977,7 @@ bool Worker::syncCustomerRepositoryAndFS() {
QDir dir1(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/psa_tariff")); QDir dir1(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/psa_tariff"));
QDir dir2("/etc/psa_tariff"); QDir dir2("/etc/psa_tariff");
if (Utils::sameFilesInDirs(dir1, dir2)) { if (Utils::sameFilesInDirs(dir1, dir2)) {
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS)); CONSOLE() << UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS;
setProgress(_SYNC_CUSTOMER_REPOSITORY_SUCCESS); setProgress(_SYNC_CUSTOMER_REPOSITORY_SUCCESS);
return true; return true;
} }