Update process: check sanity of customer repository: are etc/ and
opt/directories contained? If not, remove the repository and clone it again. This is done without checking the ISMAS-WAIT-button.
This commit is contained in:
parent
4469a23f9c
commit
4bb8e241b6
130
worker.cpp
130
worker.cpp
@ -237,52 +237,88 @@ void Worker::privateUpdate() {
|
|||||||
emit disableExit();
|
emit disableExit();
|
||||||
|
|
||||||
m_returnCode = -1;
|
m_returnCode = -1;
|
||||||
|
|
||||||
QDir customerRepository(m_customerRepository);
|
QDir customerRepository(m_customerRepository);
|
||||||
if (!customerRepository.exists()) {
|
QDir customerRepositoryEtc(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/"));
|
||||||
|
|
||||||
|
Utils::printUpdateStatusMsg(
|
||||||
|
QStringList()
|
||||||
|
<< QString("STEP 1: CHECK SANITY OF CUSTOMER REPOSITORY %1...")
|
||||||
|
.arg(m_customerRepository));
|
||||||
|
|
||||||
|
bool initialClone = false; // the customer repository is cloned without
|
||||||
|
// checking the ISMAS-trigger (WAIT-)button.
|
||||||
|
// but if there was a sane repository
|
||||||
|
// available, then the trigger-button must
|
||||||
|
// have been activated in ISMAS.
|
||||||
|
|
||||||
|
bool continueUpdate = true; // check if git-clone command has timed-out,
|
||||||
|
// resulting in a corrupted git-repository, which
|
||||||
|
// does not contain an ./etc-directory
|
||||||
|
if (isRepositoryCorrupted()) {
|
||||||
|
QString s("CORRUPTED CUSTOMER REPOSITORY. REPAIRING...");
|
||||||
|
if ((continueUpdate = repairCorruptedRepository()) == true) {
|
||||||
|
Utils::printUpdateStatusMsg(
|
||||||
|
QStringList() << s <<
|
||||||
|
QString("CORRUPTED CUSTOMER REPOSITORY. REPAIRING...DONE"));
|
||||||
|
} else {
|
||||||
|
Utils::printUpdateStatusMsg(
|
||||||
|
QStringList() << s <<
|
||||||
|
QString("CORRUPTED CUSTOMER REPOSITORY. REPAIRING...FAIL"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (continueUpdate) {
|
||||||
|
|
||||||
|
Utils::printUpdateStatusMsg(
|
||||||
|
QStringList()
|
||||||
|
<< QString("STEP 1: CHECKED SANITY OF CUSTOMER REPOSITORY %1 DONE")
|
||||||
|
.arg(m_customerRepository)
|
||||||
|
<< QString("STEP 2: FETCH CUSTOMER REPOSITORY %1...")
|
||||||
|
.arg(m_customerRepository));
|
||||||
|
|
||||||
|
if ((continueUpdate = customerRepository.exists()) == false) {
|
||||||
emit appendText("\nInitializing customer environment ...");
|
emit appendText("\nInitializing customer environment ...");
|
||||||
startProgressLoop();
|
startProgressLoop();
|
||||||
|
for (int i = 0; i < 5; ++i) { // try to checkout git repository
|
||||||
|
setProgress(i); // and switch to branch
|
||||||
if (m_gc.gitCloneAndCheckoutBranch()) {
|
if (m_gc.gitCloneAndCheckoutBranch()) {
|
||||||
stopProgressLoop();
|
if (!isRepositoryCorrupted()) {
|
||||||
emit replaceLast("Initializing customer environment", UPDATE_STEP_DONE);
|
emit replaceLast("Initializing customer environment", UPDATE_STEP_DONE);
|
||||||
|
m_returnCode = sendCloneAndCheckoutSuccess();
|
||||||
setProgress(5);
|
continueUpdate = true;
|
||||||
|
initialClone = true;
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_SUCCESS,
|
Utils::printInfoMsg("INITIAL CLONE DONE");
|
||||||
QString("CLONED AND CHECKED OUT: ") + m_customerRepository);
|
break;
|
||||||
|
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
||||||
m_ismasClient.cloneAndCheckoutCustomerRepository(
|
|
||||||
m_updateStatus.m_statusDescription));
|
|
||||||
|
|
||||||
setProgress(10);
|
|
||||||
|
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
||||||
m_ismasClient.updateOfPSASucceeded(""));
|
|
||||||
|
|
||||||
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 {
|
|
||||||
stopProgressLoop();
|
|
||||||
setProgress(0);
|
|
||||||
|
|
||||||
emit replaceLast("Initializing customer environment", UPDATE_STEP_FAIL);
|
|
||||||
|
|
||||||
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=") +
|
|
||||||
m_ismasClient.errorGitClone(100, m_updateStatus.m_statusDescription));
|
|
||||||
|
|
||||||
m_returnCode = -3;
|
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
if (updateTriggerSet(5)) {
|
|
||||||
|
QThread::sleep(1); // maybe git needs more time
|
||||||
|
}
|
||||||
|
if (continueUpdate == false) {
|
||||||
|
emit replaceLast("Initializing customer environment", UPDATE_STEP_FAIL);
|
||||||
|
m_returnCode = sendCloneAndCheckoutFailure();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (continueUpdate) { // repository is neither not existent nor
|
||||||
|
// corrupted. check now if the ISMAS-trigger
|
||||||
|
// (WAIT-BUTTON) is activated even in case of
|
||||||
|
// initial checkout
|
||||||
|
if (!initialClone) {
|
||||||
|
|
||||||
|
Utils::printUpdateStatusMsg(
|
||||||
|
QStringList()
|
||||||
|
<< QString("STEP 2: FETCHED CUSTOMER REPOSITORY %1 DONE")
|
||||||
|
.arg(m_customerRepository)
|
||||||
|
<< QString("STEP 3: CHECK ISMAS-UPDATE-TRIGGER FOR WAIT-STATUS..."));
|
||||||
|
|
||||||
|
//if ((continueUpdate = updateTriggerSet(10)) == false) {
|
||||||
|
// m_returnCode = sendIsmasTriggerFailure();
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (updateTriggerSet(10)) {
|
||||||
if (customerEnvironment(30)) {
|
if (customerEnvironment(30)) {
|
||||||
m_ismasClient.setProgressInPercent(50);
|
m_ismasClient.setProgressInPercent(50);
|
||||||
if (filesToUpdate()) {
|
if (filesToUpdate()) {
|
||||||
@ -373,14 +409,12 @@ void Worker::privateUpdate() {
|
|||||||
m_returnCode = -6;
|
m_returnCode = -6;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_SET_FAILURE,
|
m_returnCode = sendIsmasTriggerFailure();
|
||||||
QString("ISMAS update trigger wrong"));
|
}
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
} else { // initialClone
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
Utils::printUpdateStatusMsg(
|
||||||
m_ismasClient.updateOfPSAFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
QString("STEP 2: FETCHED CUSTOMER REPOSITORY %1 DONE")
|
||||||
"CHECK-UPDATE-TRIGGER",
|
.arg(m_customerRepository));
|
||||||
m_updateStatus.m_statusDescription));
|
|
||||||
m_returnCode = -5;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user