Compare commits
14 Commits
48073ab1f0
...
6b4c486549
Author | SHA1 | Date | |
---|---|---|---|
6b4c486549 | |||
9c44656104 | |||
d57914957d | |||
c4f12ce75a | |||
4ad370ea46 | |||
44ad3caf2b | |||
427a272f8f | |||
96fb50e68d | |||
19274546c9 | |||
d2d730589b | |||
f88b0edb2a | |||
c62299aa72 | |||
c054668eac | |||
82352713f1 |
@ -86,7 +86,7 @@ bool GitClient::gitCheckoutBranch() {
|
||||
// TODO: nachsehen, ob der Branch ueberhaupt existiert
|
||||
|
||||
if (QDir(m_customerRepository).exists()) {
|
||||
int zoneNr = Utils::read1stLineOfFile("/etc/zone_nr");
|
||||
int zoneNr = Utils::read1stLineOfFile("/mnt/system_data/zone_nr");
|
||||
m_branchName = (zoneNr != 0)
|
||||
? QString("zg1/zone%1").arg(zoneNr) : "master";
|
||||
|
||||
@ -165,13 +165,7 @@ std::optional<QStringList> GitClient::gitDiff(QString const &commits) {
|
||||
std::optional<QString> GitClient::gitFetch() {
|
||||
if (QDir(m_customerRepository).exists()) {
|
||||
|
||||
// TODO
|
||||
UpdateStatus status (UPDATE_STATUS::GIT_FETCH_UPDATES, "GIT FETCH UPDATES");
|
||||
qInfo() << status;
|
||||
|
||||
//emit m_worker->sendCmdEventToIsmas(
|
||||
// m_worker->getIsmasClient().updateOfPSAContinues(
|
||||
// "GIT FETCH UPDATES", status.m_statusDescription));
|
||||
qCritical() << "BRANCH NAME" << m_branchName;
|
||||
|
||||
Command c("git fetch");
|
||||
if (c.execute(m_customerRepository)) {
|
||||
@ -179,36 +173,51 @@ std::optional<QString> GitClient::gitFetch() {
|
||||
if (!s.isEmpty()) {
|
||||
QStringList lines = Update::split(s, '\n');
|
||||
if (!lines.empty()) {
|
||||
// 409f198..6c22726 zg1/zone1 -> origin/zg1/zone1
|
||||
static QRegularExpression re("(^\\s*)([0-9A-Fa-f]+..[0-9A-Fa-f]+)(.*$)");
|
||||
QRegularExpressionMatch match = re.match(lines.last());
|
||||
if (match.hasMatch()) {
|
||||
if (re.captureCount() == 3) { // start with full match (0), then the other 3 matches
|
||||
// TODO
|
||||
status = UpdateStatus(UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST_SUCCESS,
|
||||
QString("GIT SUCCESSFULLY FETCHED ") + m_customerRepository);
|
||||
qInfo() << status;
|
||||
|
||||
//emit m_worker->sendCmdEventToIsmas(
|
||||
// m_worker->getIsmasClient().updateOfPSAContinues(
|
||||
// "GIT_FETCH_UPDATES SUCCESS", status.m_statusDescription));
|
||||
|
||||
return match.captured(2);
|
||||
} else {
|
||||
qCritical() << "ERROR WRONG CAPTURE COUNT FOR 'GIT FETCH'" << re.captureCount();
|
||||
int zoneNr = Utils::read1stLineOfFile("/mnt/system_data/zone_nr");
|
||||
m_branchName = (zoneNr != 0) ? QString("zg1/zone%1").arg(zoneNr) : "master";
|
||||
// lines can look like this:
|
||||
// From https://git.mimbach49.de/GerhardHoffmann/customer_281
|
||||
// 41ec581..5d25ac3 master -> origin/master
|
||||
// ff10f57..43530a1 zg1/zone1 -> origin/zg1/zone1
|
||||
// 6ed893f..5d9882c zg1/zone2 -> origin/zg1/zone2
|
||||
// 4384d17..77045d8 zg1/zone3 -> origin/zg1/zone3
|
||||
// 89d2812..36a0d74 zg1/zone5 -> origin/zg1/zone5
|
||||
bool found = false;
|
||||
for (int i=0; i < lines.size(); ++i) {
|
||||
if (lines.at(i).contains(m_branchName)) {
|
||||
found = true;
|
||||
// 409f198..6c22726 zg1/zone1 -> origin/zg1/zone1
|
||||
static QRegularExpression re("(^\\s*)([0-9A-Fa-f]+..[0-9A-Fa-f]+)(.*$)");
|
||||
QRegularExpressionMatch match = re.match(lines.at(i));
|
||||
if (match.hasMatch()) {
|
||||
if (re.captureCount() == 3) { // start with full match (0), then the other 3 matches
|
||||
return match.captured(2);
|
||||
} else {
|
||||
emit m_worker->showErrorMessage("git fetch",
|
||||
QString("(wrong cap-count (%1)").arg(re.captureCount()));
|
||||
}
|
||||
} else {
|
||||
emit m_worker->showErrorMessage("git fetch",
|
||||
"regex-match for commits");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
qCritical() << "ERROR NO MATCH OF COMMITS FOR 'GIT FETCH'";
|
||||
}
|
||||
if (!found) {
|
||||
emit m_worker->showErrorMessage("git fetch",
|
||||
QString("unkown branch name ") + m_branchName);
|
||||
}
|
||||
} else {
|
||||
qCritical() << "ERROR WRONG FORMAT FOR RESULT FOR 'GIT FETCH'" << s;
|
||||
emit m_worker->showErrorMessage("git fetch",
|
||||
QString("wrong format for result of 'git fetch' ") + s);
|
||||
}
|
||||
} else {
|
||||
qCritical() << "ERROR EMPTY RESULT FROM 'GIT FETCH'";
|
||||
emit m_worker->showErrorMessage("git fetch",
|
||||
"empty result for 'git fetch'");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
qCritical() << "ERROR" << m_customerRepository << "DOES NOT EXIST";
|
||||
emit m_worker->showErrorMessage("git fetch",
|
||||
QString("repository ") + m_customerRepository + " does not exist");
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
1
main.cpp
1
main.cpp
@ -146,6 +146,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
MainWindow mw(&worker);
|
||||
mw.setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
|
||||
mw.setWindowState(Qt::WindowFullScreen);
|
||||
mw.show();
|
||||
|
||||
return a.exec();
|
||||
|
@ -17,6 +17,25 @@ MainWindow::MainWindow(Worker *worker, QWidget *parent)
|
||||
ui->updateProgress->setRange(1, 100);
|
||||
ui->updateProgress->reset();
|
||||
|
||||
QStringList lst;
|
||||
QString start = QDateTime::currentDateTime().toString(Qt::ISODate);
|
||||
lst << QString("Start: ") + start.leftJustified(m_width-10);
|
||||
lst << QString("").leftJustified(m_width-3, '=');
|
||||
lst << QString("Machine number : %1 ").arg(m_worker->machineNr()).leftJustified(m_width-3);
|
||||
lst << QString("Customer number : %1 ").arg(m_worker->customerNr()).leftJustified(m_width-3);
|
||||
lst << QString("Zone number : %1 (%2)").arg(m_worker->zoneNr()).arg(Utils::zoneName(m_worker->zoneNr())).leftJustified(m_width-3);
|
||||
lst << QString("").leftJustified(m_width-3, '=');
|
||||
|
||||
ui->updateStatus->setText(lst.join('\n'));
|
||||
ui->updateStatus->setEnabled(true);
|
||||
|
||||
ui->reserved_1->setVisible(false);
|
||||
ui->reserved_2->setVisible(false);
|
||||
ui->reserved_3->setVisible(false);
|
||||
ui->reserved_4->setVisible(false);
|
||||
ui->reserved_5->setVisible(false);
|
||||
ui->reserved_6->setVisible(false);
|
||||
|
||||
m_startTimer = new QTimer(this);
|
||||
connect(m_startTimer, SIGNAL(timeout()), ui->start, SLOT(click()));
|
||||
m_startTimer->setSingleShot(true);
|
||||
@ -28,8 +47,7 @@ MainWindow::MainWindow(Worker *worker, QWidget *parent)
|
||||
m_exitTimer->start(1800 * 1000);
|
||||
|
||||
connect(m_startTimer, SIGNAL(timeout()), ui->start, SLOT(click()));
|
||||
//connect(m_exitTimer, SIGNAL(timeout()), ui->exit, SLOT(click()));
|
||||
connect(m_exitTimer, SIGNAL(timeout()), ui->exit, SLOT(onQuit()));
|
||||
connect(m_exitTimer, SIGNAL(timeout()), ui->exit, SLOT(click()));
|
||||
connect(ui->start, SIGNAL(clicked()), m_worker, SLOT(update()));
|
||||
connect(ui->exit, SIGNAL(clicked()), this, SLOT(onQuit()));
|
||||
connect(m_worker, SIGNAL(disableExit()), this, SLOT(onDisableExit()));
|
||||
@ -40,15 +58,6 @@ MainWindow::MainWindow(Worker *worker, QWidget *parent)
|
||||
connect(m_worker, SIGNAL(showErrorMessage(QString,QString)), this, SLOT(onShowErrorMessage(QString,QString)));
|
||||
connect(m_worker, SIGNAL(setProgress(quint8)), this, SLOT(onSetProgress(quint8)));
|
||||
|
||||
QStringList lst;
|
||||
QString start = QDateTime::currentDateTime().toString(Qt::ISODate);
|
||||
lst << QString("Start: ") + start.leftJustified(m_width-10);
|
||||
lst << QString("").leftJustified(m_width-3, '=');
|
||||
lst << QString("Machine number : %1 ").arg(m_worker->machineNr()).leftJustified(m_width-3);
|
||||
lst << QString("Customer number : %1 ").arg(m_worker->customerNr()).leftJustified(m_width-3);
|
||||
lst << QString("Zone number : %1 (%2)").arg(m_worker->zoneNr()).arg(Utils::zoneName(m_worker->zoneNr())).leftJustified(m_width-3);
|
||||
lst << QString("").leftJustified(m_width-3, '=');
|
||||
|
||||
ui->updateStatus->setText(lst.join('\n'));
|
||||
ui->updateStatus->setEnabled(true);
|
||||
}
|
||||
@ -77,13 +86,13 @@ void MainWindow::onRestartExitTimer() {
|
||||
}
|
||||
|
||||
void MainWindow::onQuit() {
|
||||
// if (!m_worker->updateProcessRunning()) {
|
||||
qCritical() << "ON QUIT: EXIT CODE" << QString::number(m_worker->returnCode());
|
||||
m_exitTimer->stop();
|
||||
qCritical() << QString("ON QUIT: EXIT CODE %1").arg(m_worker->returnCode());
|
||||
qApp->exit(m_worker->returnCode());
|
||||
//}
|
||||
}
|
||||
|
||||
void MainWindow::onSetProgress(quint8 v) {
|
||||
qCritical() << "ON SET PROGRESS" << v;
|
||||
ui->updateProgress->setValue(v);
|
||||
}
|
||||
|
||||
@ -109,5 +118,5 @@ void MainWindow::onAppendText(QString text, QString suffix) {
|
||||
}
|
||||
|
||||
void MainWindow::onShowErrorMessage(QString title, QString text) {
|
||||
// QMessageBox::critical(this, title, text, QMessageBox::Ok);
|
||||
QMessageBox::critical(this, title, text, QMessageBox::Ok);
|
||||
}
|
||||
|
112
mainwindow.ui
112
mainwindow.ui
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>370</width>
|
||||
<height>358</height>
|
||||
<width>800</width>
|
||||
<height>480</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
@ -22,34 +22,13 @@
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<x>11</x>
|
||||
<y>11</y>
|
||||
<width>351</width>
|
||||
<height>341</height>
|
||||
<width>781</width>
|
||||
<height>461</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QTextEdit" name="updateStatus">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Noto Sans</family>
|
||||
<pointsize>8</pointsize>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QProgressBar" name="updateProgress">
|
||||
<property name="value">
|
||||
<number>24</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="start">
|
||||
<property name="font">
|
||||
@ -69,6 +48,87 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="reserved_1">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QPushButton" name="reserved_2">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="4">
|
||||
<widget class="QPushButton" name="reserved_3">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="5">
|
||||
<widget class="QPushButton" name="reserved_4">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="6">
|
||||
<widget class="QPushButton" name="reserved_6">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="7">
|
||||
<widget class="QPushButton" name="reserved_5">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="8">
|
||||
<widget class="QTextEdit" name="updateStatus">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Noto Sans</family>
|
||||
<pointsize>8</pointsize>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="8">
|
||||
<widget class="QProgressBar" name="updateProgress">
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -62,10 +62,11 @@ bool Command::execute(QString workingDirectory, QStringList args) {
|
||||
if (p->waitForFinished(m_waitForFinishTimeout)) {
|
||||
//qDebug() << "PROCESS" << m_command << "FINISHED";
|
||||
if (p->exitStatus() == QProcess::NormalExit) {
|
||||
//qInfo() << "EXECUTED" << m_command
|
||||
// << "with code" << p->exitCode();
|
||||
// qInfo() << "RESULT" << m_commandResult;
|
||||
return true;
|
||||
if (p->exitCode() == 0) {
|
||||
return true;
|
||||
} else {
|
||||
qCritical() << "EXECUTED" << m_command << "with code" << p->exitCode();
|
||||
}
|
||||
} else {
|
||||
qCritical() << "PROCESS" << m_command << "CRASHED with code"
|
||||
<< p->exitCode();
|
||||
|
85
worker.cpp
85
worker.cpp
@ -132,6 +132,8 @@ void Worker::privateUpdate() {
|
||||
QDir customerRepository(m_customerRepository);
|
||||
if (!customerRepository.exists()) {
|
||||
if (m_gc.gitCloneAndCheckoutBranch()) {
|
||||
emit appendText("\nInitializing customer environment", UPDATE_STEP_DONE);
|
||||
|
||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::UPDATE_PROCESS_SUCCESS,
|
||||
QString("CLONED AND CHECKED OUT: ") + m_customerRepository);
|
||||
|
||||
@ -144,13 +146,17 @@ void Worker::privateUpdate() {
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
m_ismasClient.updateOfPSASucceeded(""));
|
||||
|
||||
emit setProgress(95);
|
||||
m_ismasClient.setProgressInPercent(95);
|
||||
emit appendText(QString(""), UPDATE_STEP_SUCCESS);
|
||||
|
||||
emit setProgress(100);
|
||||
m_ismasClient.setProgressInPercent(100);
|
||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") + m_ismasClient.updateOfPSAActivated());
|
||||
|
||||
m_returnCode = 0;
|
||||
}
|
||||
} else {
|
||||
qCritical() << "CHECKOUT BRANCH...";
|
||||
// checkout branch
|
||||
if (m_gc.gitCheckoutBranch()) {
|
||||
int progress = 10;
|
||||
@ -161,44 +167,56 @@ void Worker::privateUpdate() {
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
m_ismasClient.checkoutBranch(
|
||||
m_updateStatus.m_statusDescription, ""));
|
||||
|
||||
emit setProgress(progress);
|
||||
if (backendConnected()) {
|
||||
|
||||
qCritical() << "CHECKED OUT BRANCH";
|
||||
if (backendConnected()) { qCritical() << "BACKEND CONNECTED";
|
||||
progress = 20;
|
||||
emit setProgress(progress);
|
||||
m_ismasClient.setProgressInPercent(progress);
|
||||
if (updateTriggerSet()) {
|
||||
if (updateTriggerSet()) { qCritical() << "UPDATE TRIGGER SET";
|
||||
progress = 30;
|
||||
emit setProgress(progress);
|
||||
m_ismasClient.setProgressInPercent(progress);
|
||||
if (customerEnvironment()) {
|
||||
if (customerEnvironment()) { qCritical() << "CUSTOMER ENVIRONMENT";
|
||||
progress = 40;
|
||||
emit setProgress(progress);
|
||||
m_ismasClient.setProgressInPercent(progress);
|
||||
if (filesToUpdate()) {
|
||||
if (filesToUpdate()) { qCritical() << "FILES TO UPDATE";
|
||||
progress = 50;
|
||||
emit setProgress(progress);
|
||||
m_ismasClient.setProgressInPercent(progress);
|
||||
if (updateFiles(progress)) {
|
||||
if (updateFiles(progress)) { qCritical() << "UPDATE FILES";
|
||||
progress = 60;
|
||||
emit setProgress(progress);
|
||||
m_ismasClient.setProgressInPercent(progress);
|
||||
if (syncCustomerRepositoryAndFS()) {
|
||||
if (syncCustomerRepositoryAndFS()) { qCritical() << "SYNC REPOSITORY";
|
||||
progress = 70;
|
||||
emit setProgress(progress);
|
||||
m_ismasClient.setProgressInPercent(progress);
|
||||
if (sendIsmasLastVersionNotification()) {
|
||||
if (sendIsmasLastVersionNotification()) { qCritical() << "SEND LAST NOTIFICATION";
|
||||
progress = 80;
|
||||
emit setProgress(progress);
|
||||
m_ismasClient.setProgressInPercent(progress);
|
||||
sentIsmasLastVersionNotification = true;
|
||||
if (saveLogFile()) {
|
||||
if (saveLogFile()) { qCritical() << "SAVE LOG FILE";
|
||||
progress = 90;
|
||||
emit setProgress(progress);
|
||||
m_ismasClient.setProgressInPercent(progress);
|
||||
emit appendText(QString(""), UPDATE_STEP_SUCCESS);
|
||||
|
||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
m_ismasClient.updateOfPSASucceeded(""));
|
||||
|
||||
// mark update as activated -> this resets the WAIT button
|
||||
progress = 100;
|
||||
emit setProgress(progress);
|
||||
|
||||
m_ismasClient.setProgressInPercent(progress);
|
||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
m_ismasClient.updateOfPSAActivated());
|
||||
|
||||
m_returnCode = 0;
|
||||
} else {
|
||||
m_returnCode = -9;
|
||||
@ -228,23 +246,19 @@ void Worker::privateUpdate() {
|
||||
m_returnCode = -1;
|
||||
}
|
||||
}
|
||||
|
||||
emit setProgress(100);
|
||||
m_ismasClient.setProgressInPercent(100);
|
||||
|
||||
if (!sentIsmasLastVersionNotification) {
|
||||
// try even if the backend is not connected
|
||||
emit setProgress(100);
|
||||
m_ismasClient.setProgressInPercent(100);
|
||||
|
||||
if (m_returnCode == 0) {
|
||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
m_ismasClient.updateOfPSASucceeded(""));
|
||||
emit appendText(QString(""), UPDATE_STEP_SUCCESS);
|
||||
} else {
|
||||
emit appendText(QString(""), UPDATE_STEP_FAIL);
|
||||
}
|
||||
|
||||
sendIsmasLastVersionNotification();
|
||||
}
|
||||
|
||||
if (m_returnCode != 0) {
|
||||
emit appendText(QString("Update process "), UPDATE_STEP_FAIL);
|
||||
}
|
||||
|
||||
m_updateProcessRunning = false;
|
||||
emit enableExit();
|
||||
emit restartExitTimer();
|
||||
@ -254,11 +268,13 @@ bool Worker::backendConnected() {
|
||||
static int repeat = 0;
|
||||
|
||||
if (repeat < 3) {
|
||||
qCritical() << "In backendConnected() -> #M=APISM#C=REQ_SELF#J={}";
|
||||
std::optional<QString> result
|
||||
= IsmasClient::sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DIRECT_PORT, "#M=APISM#C=REQ_SELF#J={}");
|
||||
if (result) {
|
||||
QString msg = result.value();
|
||||
qCritical() << "In backendConnected() -> APISM response" << msg;
|
||||
QJsonParseError parseError;
|
||||
QJsonDocument document(QJsonDocument::fromJson(msg.toUtf8(), &parseError));
|
||||
if (parseError.error != QJsonParseError::NoError) {
|
||||
@ -281,7 +297,7 @@ bool Worker::backendConnected() {
|
||||
bool ismas = obj.value("ISMAS").toBool();
|
||||
QString status = obj.value("Broker").toString();
|
||||
|
||||
qCritical() << "STATUS" << status;
|
||||
qCritical() << "In backendConnected() STATUS" << status;
|
||||
|
||||
if (ismas) {
|
||||
if (status == "Connected") {
|
||||
@ -303,6 +319,8 @@ bool Worker::backendConnected() {
|
||||
}
|
||||
}
|
||||
}
|
||||
qCritical() << "In backendConnected() ERROR";
|
||||
|
||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::BACKEND_NOT_CONNECTED,
|
||||
QString("NO BACKEND CONNECTION"));
|
||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
@ -459,10 +477,11 @@ bool Worker::filesToUpdate() {
|
||||
} else {
|
||||
emit appendText(QString("\nFound 1 file to update "), UPDATE_STEP_DONE);
|
||||
}
|
||||
if (!m_gc.gitPull()) {
|
||||
emit showErrorMessage("files to update", "pulling files failed");
|
||||
if (m_gc.gitPull()) {
|
||||
emit appendText(QString("\nFetch changes files "), UPDATE_STEP_DONE);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
emit showErrorMessage("files to update", "pulling files failed");
|
||||
} else {
|
||||
emit showErrorMessage("files to update", "no files to update (checked-in any files?)");
|
||||
}
|
||||
@ -532,7 +551,8 @@ bool Worker::updateFiles(quint8 percent) {
|
||||
bool Worker::syncCustomerRepositoryAndFS() {
|
||||
if (QDir(m_customerRepository).exists()) {
|
||||
if (QDir::setCurrent(m_customerRepository)) {
|
||||
QString const params("--recursive "
|
||||
QString const params("-vv "
|
||||
"--recursive "
|
||||
"--progress "
|
||||
"--checksum "
|
||||
"--exclude=.* "
|
||||
@ -551,9 +571,14 @@ bool Worker::syncCustomerRepositoryAndFS() {
|
||||
Command c("bash");
|
||||
qInfo() << "EXECUTING CMD..." << cmd;
|
||||
if (c.execute(m_customerRepository, QStringList() << "-c" << cmd)) {
|
||||
qCritical() << c.getCommandResult() << "SUCCESS";
|
||||
QStringList result = c.getCommandResult().split('\n');
|
||||
for (int i = 0; i < result.size(); ++i) {
|
||||
qCritical() << result.at(i);
|
||||
}
|
||||
qCritical() << "SUCCESS";
|
||||
} else {
|
||||
qCritical() << "CMD" << cmd << "FAILED";
|
||||
qCritical() << c.getCommandResult().split('\n');
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
|
2
worker.h
2
worker.h
@ -157,7 +157,7 @@ public:
|
||||
IsmasClient const &getIsmasClient() const { return m_ismasClient; }
|
||||
|
||||
bool updateProcessRunning() const { return m_updateProcessRunning; }
|
||||
bool returnCode() const { return m_returnCode; }
|
||||
int returnCode() const { return m_returnCode; }
|
||||
|
||||
int machineNr() const { return m_machineNr; }
|
||||
int customerNr() const { return m_customerNr; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user