finished(): send messages to ISMAS
This commit is contained in:
parent
226dbbd050
commit
43f60251ef
@ -1,5 +1,6 @@
|
|||||||
#include "update_command.h"
|
#include "update_command.h"
|
||||||
#include "worker.h"
|
#include "worker.h"
|
||||||
|
#include "utils_internal.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
@ -19,20 +20,13 @@ bool UpdateCommand::stopUpdateOnFailure() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UpdateCommand::finished(int exitCode, QProcess::ExitStatus exitStatus) {
|
void UpdateCommand::finished(int exitCode, QProcess::ExitStatus exitStatus) {
|
||||||
|
|
||||||
qCritical() << __func__ << ":" << __LINE__ << m_command
|
|
||||||
<< "exitCode" << exitCode
|
|
||||||
<< "exitStatus" << exitStatus;
|
|
||||||
|
|
||||||
QProcess *p = qobject_cast<QProcess *>(sender());
|
QProcess *p = qobject_cast<QProcess *>(sender());
|
||||||
if (p) {
|
if (p) {
|
||||||
// read all remaining data sent to the process, just in case
|
// read all remaining data sent to the process, just in case
|
||||||
QString s = p->readAllStandardOutput().trimmed();
|
QString s = p->readAllStandardOutput().trimmed();
|
||||||
if (!s.isEmpty()) {
|
if (!s.isEmpty()) {
|
||||||
qCritical() << __func__ << ":" << __LINE__ << s;
|
|
||||||
m_commandResult += s;
|
m_commandResult += s;
|
||||||
}
|
}
|
||||||
qCritical() << __func__ << ":" << __LINE__ << "next command" << m_nextCommandIndex;
|
|
||||||
|
|
||||||
disconnect(p, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(readyReadStandardOutput()));
|
disconnect(p, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(readyReadStandardOutput()));
|
||||||
disconnect(p, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(readyReadStandardError()));
|
disconnect(p, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(readyReadStandardError()));
|
||||||
@ -40,13 +34,101 @@ void UpdateCommand::finished(int exitCode, QProcess::ExitStatus exitStatus) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!m_worker->workList().empty()) {
|
if (!m_worker->workList().empty()) {
|
||||||
|
|
||||||
|
//static constexpr const int PERCENT_CHECK_ISMAS_CONNECIVITY{10};
|
||||||
|
//static constexpr const int PERCENT_CHECK_UPDATE_REQUEST{20};
|
||||||
|
//static constexpr const int PERCENT_CHECK_CUSTOMER_REPOSITORY{30};
|
||||||
|
//static constexpr const int PERCENT_INSTALL_SW_PACKETS_NOACTION{40};
|
||||||
|
//static constexpr const int PERCENT_INSTALL_SW_PACKETS{50};
|
||||||
|
//static constexpr const int PERCENT_INSTALL_DC_CONFIGURATION{60};
|
||||||
|
//static constexpr const int PERCENT_SYNCHRONIZE_REPO_AND_FILESYS{70};
|
||||||
|
//static constexpr const int PERCENT_UPDATE_DC{80};
|
||||||
|
//static constexpr const int PERCENT_SHOW_FINAL_STATUS{90};
|
||||||
|
|
||||||
|
qCritical() << __func__ << ":" << __LINE__ << m_command
|
||||||
|
<< "exitCode" << exitCode
|
||||||
|
<< "exitStatus" << exitStatus;
|
||||||
|
|
||||||
if (exitCode == 0 && exitStatus == QProcess::ExitStatus::NormalExit) {
|
if (exitCode == 0 && exitStatus == QProcess::ExitStatus::NormalExit) {
|
||||||
qCritical() << __func__ << ":" << __LINE__;
|
if (m_command.contains("ATBUpdateCheck")) {
|
||||||
|
|
||||||
|
// TODO: resultCodes richtig eintragen
|
||||||
|
|
||||||
|
if (m_command.contains("--ismas-connected")) {
|
||||||
|
ISMAS::EventData e(ISMAS::CONTINUE,
|
||||||
|
internal::PERCENT_CHECK_ISMAS_CONNECIVITY,
|
||||||
|
0,
|
||||||
|
"ATBUpdateCheck --ismas-connected",
|
||||||
|
"ISMAS connected");
|
||||||
|
|
||||||
|
m_worker->clientForUpdate().sendCmdEvent(e);
|
||||||
|
} else
|
||||||
|
if (m_command.contains("--update-requested")) {
|
||||||
|
ISMAS::EventData e(ISMAS::CONTINUE,
|
||||||
|
internal::PERCENT_CHECK_UPDATE_REQUEST,
|
||||||
|
0,
|
||||||
|
"ATBUpdateCheck --update-requested",
|
||||||
|
"update not necessary");
|
||||||
|
m_worker->clientForUpdate().sendCmdEvent(e);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
if (m_command.contains("ATBUpdateGit")) {
|
||||||
|
ISMAS::EventData e(ISMAS::CONTINUE,
|
||||||
|
internal::PERCENT_CHECK_CUSTOMER_REPOSITORY,
|
||||||
|
0,
|
||||||
|
"ATBUpdateGit",
|
||||||
|
"customer repository clean and up-to-date");
|
||||||
|
m_worker->clientForUpdate().sendCmdEvent(e);
|
||||||
|
} else
|
||||||
|
if (m_command.contains("ATBUpdateOpkg")) {
|
||||||
|
if (m_command.contains("--noaction")) {
|
||||||
|
ISMAS::EventData e(ISMAS::CONTINUE,
|
||||||
|
internal::PERCENT_INSTALL_SW_PACKETS_NOACTION,
|
||||||
|
0,
|
||||||
|
"ATBUpdateOpkg --noaction",
|
||||||
|
"execute opkg-commands (dry-run)");
|
||||||
|
m_worker->clientForUpdate().sendCmdEvent(e);
|
||||||
|
} else {
|
||||||
|
ISMAS::EventData e(ISMAS::CONTINUE,
|
||||||
|
internal::PERCENT_INSTALL_SW_PACKETS,
|
||||||
|
0,
|
||||||
|
"ATBUpdateOpkg",
|
||||||
|
"execute opkg-commands");
|
||||||
|
m_worker->clientForUpdate().sendCmdEvent(e);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
if (m_command.contains("ATBDownloadDCJsonFiles")) {
|
||||||
|
ISMAS::EventData e(ISMAS::CONTINUE,
|
||||||
|
internal::PERCENT_INSTALL_DC_CONFIGURATION,
|
||||||
|
0,
|
||||||
|
"ATBDownloadDCJsonFiles",
|
||||||
|
"download json-files to device controller");
|
||||||
|
m_worker->clientForUpdate().sendCmdEvent(e);
|
||||||
|
} else
|
||||||
|
if (m_command.contains("ATBUpdateSync")) {
|
||||||
|
ISMAS::EventData e(ISMAS::CONTINUE,
|
||||||
|
internal::PERCENT_SYNCHRONIZE_REPO_AND_FILESYS,
|
||||||
|
0,
|
||||||
|
"ATBUpdateSync",
|
||||||
|
"sync customer repository with /etc");
|
||||||
|
m_worker->clientForUpdate().sendCmdEvent(e);
|
||||||
|
} else
|
||||||
|
if (m_command.contains("ATBDownloadDCFirmware")) {
|
||||||
|
ISMAS::EventData e(ISMAS::CONTINUE,
|
||||||
|
internal::PERCENT_UPDATE_DC,
|
||||||
|
0,
|
||||||
|
"ATBDownloadDCFirmware",
|
||||||
|
"downloaded new dc-firmware. about to reboot...");
|
||||||
|
m_worker->clientForUpdate().sendCmdEvent(e);
|
||||||
|
} else
|
||||||
|
if (m_command.contains("ATBUpdateShowPSAInstalled")) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
if (m_worker->workList().nextExec()) {
|
if (m_worker->workList().nextExec()) {
|
||||||
m_worker->workList().exec();
|
m_worker->workList().exec();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qCritical() << __func__ << ":" << __LINE__;
|
|
||||||
bool execShowStatus = true;
|
bool execShowStatus = true;
|
||||||
m_worker->workList().exec(execShowStatus);
|
m_worker->workList().exec(execShowStatus);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user