Send message to ISMAS when rsyncing a traiff-file
This commit is contained in:
parent
a8df026a80
commit
1509e8619c
34
worker.cpp
34
worker.cpp
@ -15,6 +15,7 @@
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <QJsonParseError>
|
||||
#include <Qt>
|
||||
|
||||
#include <thread>
|
||||
|
||||
@ -514,11 +515,11 @@ bool Worker::updateTriggerSet() {
|
||||
|
||||
if (repeat > 1) {
|
||||
int const durationMs = QTime::currentTime().msecsSinceStartOfDay() - startMs;
|
||||
QString const &msg = QString("[%1] time: %2.%3s").arg(repeat).arg(durationMs / 1000).arg(durationMs % 1000);
|
||||
QString const &msg = QString("elapsed: %1.%2s").arg(durationMs / 1000).arg(durationMs % 1000);
|
||||
qInfo() << "REPEAT" << msg;
|
||||
emit showErrorMessage("check update trigger", msg);
|
||||
} else {
|
||||
emit showErrorMessage("check update trigger", QString("[%1]").arg(repeat));
|
||||
emit showErrorMessage("check update trigger", "");
|
||||
}
|
||||
|
||||
if ((repeat % 10) == 0) {
|
||||
@ -970,7 +971,7 @@ bool Worker::syncCustomerRepositoryAndFS() {
|
||||
}
|
||||
int progress = 10;
|
||||
setProgress(progress);
|
||||
QString const params("-vv "
|
||||
QString const params("-vvv "
|
||||
"--recursive "
|
||||
"--progress "
|
||||
"--checksum "
|
||||
@ -993,8 +994,25 @@ bool Worker::syncCustomerRepositoryAndFS() {
|
||||
qInfo() << "EXECUTING CMD..." << cmd;
|
||||
if (c.execute(m_customerRepository, QStringList() << "-c" << cmd)) {
|
||||
QStringList result = c.getCommandResult().split('\n');
|
||||
QString const &p1 = "send_files mapped ";
|
||||
QString const &p2 = "of size";
|
||||
for (int i = 0; i < result.size(); ++i) {
|
||||
qInfo() << result.at(i);
|
||||
QString line = result.at(i);
|
||||
qInfo() << line;
|
||||
|
||||
// "send_files mapped etc/psa_tariff/tariff01.json of size 19339"
|
||||
int sendFilesAtPos = line.indexOf(p1);
|
||||
int ofSizeAtPos = line.indexOf(p2);
|
||||
if (sendFilesAtPos != -1 && ofSizeAtPos != -1) {
|
||||
sendFilesAtPos += p1.length();
|
||||
QString const &s = line.mid(sendFilesAtPos, ofSizeAtPos - sendFilesAtPos).trimmed();
|
||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::RSYNC_FILE_SUCCESS,
|
||||
QString("RSYNC FILE ") + s.split("/").last() +
|
||||
" LAST-COMMIT: " + m_gc.gitLastCommit(s));
|
||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
m_ismasClient.rsyncFile(m_updateStatus.m_statusDescription, ""));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Utils::printCriticalErrorMsg(QString("CMD ") + cmd + " FAILED: "
|
||||
@ -1345,6 +1363,10 @@ QDebug operator<< (QDebug debug, UpdateStatus status) {
|
||||
debug << QString("UPDATE_STATUS::ISMAS_RESPONSE_RECEIVED: ")
|
||||
<< status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::RSYNC_FILE_SUCCESS:
|
||||
debug << QString("UPDATE_STATUS::RSYNC_FILE_SUCCESS: ")
|
||||
<< status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::EXEC_OPKG_COMMANDS:
|
||||
debug << QString("UPDATE_STATUS::EXEC_OPKG_COMMANDS: ")
|
||||
<< status.m_statusDescription;
|
||||
@ -1468,6 +1490,10 @@ QString& operator<< (QString& str, UpdateStatus status) {
|
||||
str = QString("UPDATE_STATUS::EXEC_OPKG_COMMANDS: ");
|
||||
str += status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::RSYNC_FILE_SUCCESS:
|
||||
str = QString("UPDATE_STATUS::RSYNC_FILE_SUCCESS: ");
|
||||
str += status.m_statusDescription;
|
||||
break;
|
||||
//default:;
|
||||
}
|
||||
return str;
|
||||
|
Loading…
Reference in New Issue
Block a user