Streamlined handling of UPDATE_STATUS.

This commit is contained in:
Gerhard Hoffmann 2023-08-16 12:41:42 +02:00
parent 0f2ee0349f
commit 9b4d0494c8
2 changed files with 187 additions and 103 deletions

View File

@ -169,7 +169,7 @@ void Worker::privateUpdate() {
int progress = (m_mainWindow->progressValue()/10) + 10;
setProgress(progress);
m_updateStatus = UpdateStatus(UPDATE_STATUS::UPDATE_PROCESS_SUCCESS,
m_updateStatus = UpdateStatus(UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_SUCCESS,
QString("CLONED AND CHECKED OUT: ") + m_customerRepository);
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
@ -197,7 +197,7 @@ void Worker::privateUpdate() {
emit replaceLast("Initializing customer environment", UPDATE_STEP_FAIL);
m_updateStatus = UpdateStatus(UPDATE_STATUS::UPDATE_PROCESS_FAILURE,
m_updateStatus = UpdateStatus(UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_FAILURE,
QString("CLONE OR CHECKOUT FAILED: ") + m_customerRepository);
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
QString("#M=APISM#C=CMD_EVENT#J=") +
@ -295,7 +295,7 @@ void Worker::privateUpdate() {
m_returnCode = -7;
}
} else {
m_updateStatus = UpdateStatus(UPDATE_STATUS::GIT_CHECKOUT_BRANCH_REQUEST_FAILURE,
m_updateStatus = UpdateStatus(UPDATE_STATUS::GIT_CHECKOUT_BRANCH_FAILURE,
QString("Configuring customer environment failed"));
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
QString("#M=APISM#C=CMD_EVENT#J=") +
@ -315,7 +315,7 @@ void Worker::privateUpdate() {
m_returnCode = -5;
}
} else {
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_BACKEND_CHECK_FAILURE,
m_updateStatus = UpdateStatus(UPDATE_STATUS::BACKEND_CHECK_FAILURE,
QString("ISMAS backend not available"));
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
QString("#M=APISM#C=CMD_EVENT#J=") +
@ -373,7 +373,7 @@ bool Worker::backendConnected() {
emit appendText("\nConnecting backend ...");
if (false) { // so linker removes dead code
for (int repeat = 0; repeat < 50; ++repeat) {
for (int repeat = 0; repeat < 100; ++repeat) {
qInfo() << "REPEAT" << repeat << "In backendConnected() -> #M=APISM#C=REQ_SELF#J={}";
startProgressLoop();
std::optional<QString> result
@ -507,7 +507,7 @@ bool Worker::updateTriggerSet() {
emit appendText("\n" CHECK_UPDATE_TRIGGER_SET);
QString triggerValue("");
for (int repeat = 0; repeat < 50; ++repeat) {
for (int repeat = 0; repeat < 100; ++repeat) {
qInfo() << "UPDATE TRIGGER SET -> REPEAT" << repeat;
startProgressLoop();
@ -672,7 +672,7 @@ bool Worker::updateTriggerSet() {
m_ismasClient.updateOfPSAContinues("MACHINE-AND-CUSTOMER-CHECK",
m_updateStatus.m_statusDescription));
m_updateStatus = UpdateStatus(UPDATE_STATUS::UPDATE_TRIGGER_SET,
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_SET,
QString("UPDATE TRIGGER SET. CONTINUE. "));
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
QString("#M=APISM#C=CMD_EVENT#J=") +
@ -749,8 +749,8 @@ bool Worker::updateTriggerSet() {
}
setProgress(100);
m_updateStatus = UpdateStatus(UPDATE_STATUS::UPDATE_TRIGGER_NOT_SET_OR_WRONG,
QString("UPDATE-TRIGGER-NOT-SET-OR-WRONG: VALUE=(") +
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_NOT_SET_OR_WRONG,
QString("ISMAS_UPDATE-TRIGGER-NOT-SET-OR-WRONG: VALUE=(") +
triggerValue + ")");
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
QString("#M=APISM#C=CMD_EVENT#J=") +
@ -1195,6 +1195,90 @@ PSAInstalled Worker::getPSAInstalled() {
*/
QDebug operator<< (QDebug debug, UpdateStatus status) {
switch(status.m_updateStatus) {
case UPDATE_STATUS::ISMAS_SEND_LAST_VERSION_FAILED:
debug << QString("UPDATE_STATUS::ISMAS_SEND_LAST_VERSION_FAILED: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::SAVE_LOG_FILES_FAILED:
debug << QString("UPDATE_STATUS::SAVE_LOG_FILES_FAILED: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::GIT_CHECK_FILES_TO_UPDATE_SUCCESS:
debug << QString("UPDATE_STATUS::GIT_CHECK_FILES_TO_UPDATE_SUCCESS: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::PSA_UPDATE_FILES_FAILED:
debug << QString("UPDATE_STATUS::PSA_UPDATE_FILES_FAILED: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::RSYNC_UPDATES_SUCCESS:
debug << QString("UPDATE_STATUS::RSYNC_UPDATES_SUCCESS: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::RSYNC_UPDATES_FAILURE:
debug << QString("UPDATE_STATUS::RSYNC_UPDATES_FAILURE: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::EXEC_OPKG_COMMAND:
debug << QString("UPDATE_STATUS::EXEC_OPKG_COMMAND: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_SUCCESS:
debug << QString("UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_SUCCESS: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_FAILURE:
debug << QString("UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_FAILURE: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::NOT_DEFINED:
debug << QString("UPDATE_STATUS::NOT_DEFINED: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::UPDATE_PROCESS_FAILURE:
debug << QString("UPDATE_STATUS::UPDATE_PROCESS_FAILURE: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_SET_FAILURE:
debug << QString("UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_FAILURE: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::GIT_CHECKOUT_BRANCH_FAILURE:
debug << QString("UPDATE_STATUS::GIT_CHECKOUT_BRANCH_FAILURE: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::GIT_CHECKOUT_BRANCH:
debug << QString("UPDATE_STATUS::GIT_CHECKOUT_BRANCH: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_NOT_SET_OR_WRONG:
debug << QString("UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_NOT_SET_OR_WRONG: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_SET:
debug << QString("UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_SET: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::ISMAS_SANITY_CHECK_OK:
debug << QString("UPDATE_STATUS::ISMAS_SANITY_CHECK_OK: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::JSON_PARSE_FAILURE:
debug << QString("UPDATE_STATUS::JSON_PARSE_FAILURE: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::BACKEND_CHECK:
debug << QString("UPDATE_STATUS::BACKEND_CHECK: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::BACKEND_CHECK_FAILURE:
debug << QString("UPDATE_STATUS::BACKEND_CHECK_FAILURE: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::BACKEND_NOT_CONNECTED:
debug << QString("UPDATE_STATUS::BACKEND_NOT_CONNECTED: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::UPDATE_PROCESS_SUCCESS:
debug << QString("UPDATE_STATUS::UPDATE_PROCESS_SUCCESS: ")
<< status.m_statusDescription;
@ -1207,14 +1291,6 @@ QDebug operator<< (QDebug debug, UpdateStatus status) {
debug << QString("UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_TIMEOUT:
debug << QString("UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_SUCCESS:
debug << QString("UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_SUCCESS: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::GIT_FETCH_UPDATES:
debug << QString("UPDATE_STATUS::GIT_FETCH_UPDATES: ")
<< status.m_statusDescription;
@ -1223,45 +1299,109 @@ QDebug operator<< (QDebug debug, UpdateStatus status) {
debug << QString("UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST_FAILURE: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST_SUCCESS:
debug << QString("UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST_SUCCESS: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::ISMAS_RESPONSE_RECEIVED:
debug << QString("UPDATE_STATUS::ISMAS_RESPONSE_RECEIVED: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::GIT_PULL_UPDATES_SUCCESS:
debug << QString("UPDATE_STATUS::GIT_PULL_UPDATES_REQUEST: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::GIT_PULL_UPDATES_FAILURE:
debug << QString("UPDATE_STATUS::GIT_PULL_UPDATES_FAILURE: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::EXEC_OPKG_COMMANDS:
debug << QString("UPDATE_STATUS::EXEC_OPKG_COMMANDS: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::EXEC_OPKG_COMMANDS_SUCCESS:
debug << QString("UPDATE_STATUS::EXEC_OPKG_COMMANDS_SUCCESS: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::EXEC_OPKG_COMMAND_SUCCESS:
debug << QString("UPDATE_STATUS::EXEC_OPKG_COMMAND_SUCCESS: ")
<< status.m_statusDescription;
break;
case UPDATE_STATUS::EXEC_OPKG_COMMAND_FAILURE:
debug << QString("UPDATE_STATUS::EXEC_OPKG_COMMAND_FAILURE: ")
<< status.m_statusDescription;
break;
default:;
// default:;
}
return debug;
}
QString& operator<< (QString& str, UpdateStatus status) {
switch(status.m_updateStatus) {
case UPDATE_STATUS::ISMAS_SEND_LAST_VERSION_FAILED:
str = QString("UPDATE_STATUS::ISMAS_SEND_LAST_VERSION_FAILED: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::SAVE_LOG_FILES_FAILED:
str = QString("UPDATE_STATUS::SAVE_LOG_FILES_FAILED: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::GIT_CHECK_FILES_TO_UPDATE_SUCCESS:
str = QString("UPDATE_STATUS::GIT_CHECK_FILES_TO_UPDATE_SUCCESS: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::PSA_UPDATE_FILES_FAILED:
str = QString("UPDATE_STATUS::PSA_UPDATE_FILES_FAILED: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::RSYNC_UPDATES_SUCCESS:
str = QString("UPDATE_STATUS::RSYNC_UPDATES_SUCCESS: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::RSYNC_UPDATES_FAILURE:
str = QString("UPDATE_STATUS::RSYNC_UPDATES_FAILURE: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::EXEC_OPKG_COMMAND:
str = QString("UPDATE_STATUS::EXEC_OPKG_COMMAND: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_SUCCESS:
str = QString("UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_SUCCESS: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_FAILURE:
str = QString("UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_FAILURE: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::NOT_DEFINED:
str = QString("UPDATE_STATUS::NOT_DEFINED: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::UPDATE_PROCESS_FAILURE:
str = QString("UPDATE_STATUS::UPDATE_PROCESS_FAILURE: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_SET_FAILURE:
str = QString("UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_FAILURE: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::GIT_CHECKOUT_BRANCH_FAILURE:
str = QString("UPDATE_STATUS::GIT_CHECKOUT_BRANCH_FAILURE: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::GIT_CHECKOUT_BRANCH:
str = QString("UPDATE_STATUS::GIT_CHECKOUT_BRANCH: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_NOT_SET_OR_WRONG:
str = QString("UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_NOT_SET_OR_WRONG: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE:
str = QString("UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_SET:
str = QString("UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_SET: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::ISMAS_SANITY_CHECK_OK:
str = QString("UPDATE_STATUS::ISMAS_SANITY_CHECK_OK: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::JSON_PARSE_FAILURE:
str = QString("UPDATE_STATUS::JSON_PARSE_FAILURE: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::BACKEND_CHECK:
str = QString("UPDATE_STATUS::BACKEND_CHECK: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::BACKEND_CHECK_FAILURE:
str = QString("UPDATE_STATUS::BACKEND_CHECK_FAILURE: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::BACKEND_NOT_CONNECTED:
str = QString("UPDATE_STATUS::BACKEND_NOT_CONNECTED: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::UPDATE_PROCESS_SUCCESS:
str = QString("UPDATE_STATUS::UPDATE_PROCESS_SUCCESS: ");
str += status.m_statusDescription;
@ -1270,10 +1410,6 @@ QString& operator<< (QString& str, UpdateStatus status) {
str = QString("UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_PENDING: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_SUCCESS:
str = QString("UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_SUCCESS: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::GIT_FETCH_UPDATES:
str = QString("UPDATE_STATUS::GIT_FETCH_UPDATES: ");
str += status.m_statusDescription;
@ -1282,18 +1418,6 @@ QString& operator<< (QString& str, UpdateStatus status) {
str = QString("UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST_FAILURE: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST_SUCCESS:
str = QString("UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST_SUCCESS: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::GIT_PULL_UPDATES_SUCCESS:
str = QString("UPDATE_STATUS::GIT_PULL_UPDATES_SUCCESS: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::GIT_PULL_UPDATES_FAILURE:
str = QString("UPDATE_STATUS::GIT_PULL_UPDATES_FAILURE: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::ISMAS_RESPONSE_RECEIVED:
str = QString("UPDATE_STATUS::ISMAS_RESPONSE_RECEIVED: ");
str += status.m_statusDescription;
@ -1302,19 +1426,7 @@ QString& operator<< (QString& str, UpdateStatus status) {
str = QString("UPDATE_STATUS::EXEC_OPKG_COMMANDS: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::EXEC_OPKG_COMMANDS_SUCCESS:
str = QString("UPDATE_STATUS::EXEC_OPKG_COMMANDS_SUCCESS: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::EXEC_OPKG_COMMAND_SUCCESS:
str = QString("UPDATE_STATUS::EXEC_OPKG_COMMAND_SUCCESS: ");
str += status.m_statusDescription;
break;
case UPDATE_STATUS::EXEC_OPKG_COMMAND_FAILURE:
str = QString("UPDATE_STATUS::EXEC_OPKG_COMMAND_FAILURE: ");
str += status.m_statusDescription;
break;
default:;
//default:;
}
return str;
}

View File

@ -23,55 +23,27 @@
enum class UPDATE_STATUS : quint8 {
NOT_DEFINED,
STEP_OK,
STEP_DONE,
STEP_FAIL,
ISMAS_WAIT_STATE_CHECK_PENDING,
ISMAS_WAIT_STATE_CHECK_FAILURE,
ISMAS_WAIT_STATE_CHECK_TIMEOUT,
ISMAS_WAIT_STATE_CHECK_SUCCESS,
ISMAS_RESPONSE_RECEIVED,
BACKEND_CONNECTED,
BACKEND_CHECK,
BACKEND_CHECK_FAILURE,
ISMAS_BACKEND_CHECK_FAILURE,
BACKEND_NOT_CONNECTED,
UPDATE_TRIGGER_SET,
UPDATE_TRIGGER_NOT_SET_OR_WRONG,
ISMAS_UPDATE_TRIGGER_SET,
ISMAS_UPDATE_TRIGGER_NOT_SET_OR_WRONG,
GIT_CLONE_AND_CHECKOUT_SUCCESS,
GIT_CLONE_AND_CHECKOUT_FAILURE,
GIT_CHECKOUT_BRANCH,
GIT_CHECKOUT_BRANCH_REQUEST_FAILURE,
GIT_CHECKOUT_BRANCH_NOT_EXISTS,
GIT_CHECKOUT_BRANCH_CHECKOUT_ERROR,
GIT_CHECKOUT_BRANCH_FAILURE,
GIT_FETCH_UPDATES,
GIT_FETCH_UPDATES_REQUEST_FAILURE,
GIT_FETCH_UPDATES_REQUEST_SUCCESS,
GIT_PULL_UPDATES_SUCCESS,
GIT_PULL_UPDATES_FAILURE,
EXEC_OPKG_COMMAND,
EXEC_OPKG_COMMANDS,
EXEC_OPKG_COMMAND_FAILURE,
EXEC_OPKG_COMMAND_SUCCESS,
EXEC_OPKG_COMMANDS_SUCCESS,
RSYNC_UPDATES,
RSYNC_UPDATES_FAILURE,
RSYNC_UPDATES_SUCESS,
DEVICE_CONTROLLER_UPDATE,
DEVICE_CONTROLLER_UPDATE_FAILURE,
DEVICE_CONTROLLER_UPDATE_SUCCESS,
JSON_UPDATE,
JSON_UPDATE_FAILURE,
RSYNC_UPDATES_SUCCESS,
JSON_PARSE_FAILURE,
JSON_UPDATE_SUCCESS,
UPDATE_PROCESS_SUCCESS,
UPDATE_PROCESS_FAILURE,
ISMAS_UPDATE_INFO_CONFIRM,
ISMAS_UPDATE_INFO_CONFIRM_FAILURE,
ISMAS_UPDATE_INFO_CONFIRM_SUCCESS,
ISMAS_CURRENT_PSA_STATUS_CONFIRM,
ISMAS_CURRENT_PSA_STATUS_CONFIRM_FAILURE,
ISMAS_CURRENT_PSA_STATUS_CONFIRM_SUCCESS,
ISMAS_SANITY_CHECK_OK,
ISMAS_UPDATE_TRIGGER_SET_FAILURE,
PSA_UPDATE_FILES_FAILED,