Compare commits

..

2 Commits

Author SHA1 Message Date
201a1cbab9 privateUpdate():
Make sure opkg-commands re executed aunder certain error conditions:

	Failure of customerEnvironment(), filesToUpdate() or
	syncCustomerRepositoryAndFS().
2024-10-23 13:23:13 +02:00
9a9cce126a Minor: extended comment 2024-10-23 13:22:42 +02:00
2 changed files with 34 additions and 3 deletions

View File

@ -420,10 +420,17 @@ std::optional<QString> GitClient::gitPull() {
X11 forwarding is disabled to avoid man-in-the-middle attacks.
Already up to date.
This first part is from ssh itself, and could not be fetched easily, as this
process is gone when git itself starts.
This first part is from ssh itself. Only the last line is the git message.
Only the last line is the git message.
Here an output of running ATBUpdateTool with a corrupted known-hosts-file:
...
Oct 23 14:18:18 ATB_PTU5 ATBUpdateTool[2696]: ( branchExistsRemotely : 310 ) branch "zg1/zone1" EXISTS REMOTELY. ( "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r\n@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @\r\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r\nIT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!\r\nSomeone could be eavesdropping on you right now (man-in-the-middle attack)!\r\nIt is also possible that a host key has just been changed.\r\nThe fingerprint for the ECDSA key sent by the remote host is\nSHA256:vOD5jF2hglGktqLhK9ABxfEjwEgIK68/v9erdT05NDQ.\r\nPlease contact your system administrator.\r\nAdd correct host key in /home/root/.ssh/known_hosts to get rid of this message.\r\nOffending ECDSA key in /home/root/.ssh/known_hosts:1\r\nPassword authentication is disabled to avoid man-in-the-middle attacks.\r\nKeyboard-interactive authentication is disabled to avoid man-in-the-middle attacks.\r\nAgent forwarding is disabled to avoid man-in-the-middle attacks.\r\nX11 forwarding is disabled to avoid man-in-the-middle attacks.\r\nbd4e8da4780b1a7d6be3d3ce8419f43ccf7e706f\trefs/heads/zg1/zone1" )
Oct 23 14:18:18 ATB_PTU5 ATBUpdateTool[2696]: EXECUTED "git branch -l" "(runtime 16ms)" with code 0 IN "/opt/app/tools/atbupdate/customer_336"
Oct 23 14:18:18 ATB_PTU5 ATBUpdateTool[2696]: "UPDATE_STEP::PULL_NEW_BRANCH"
Oct 23 14:18:18 ATB_PTU5 ATBUpdateTool[2696]: "BRANCH-NAME zg1/zone1 CONTAINED IN RESULT master\n* zg1/zone1" .....
The download continues.
#endif
Command c("git pull");
if (c.execute(m_customerRepository)) {

View File

@ -456,6 +456,14 @@ void Worker::privateUpdate() {
//
////////////////////////////////////////////////////////////////////////////
if ((continueUpdate = customerEnvironment()) == false) {
// even if something goes wrong creating the environment, try to execute
// opkg_commands
if (QDir(m_customerRepository).exists()) {
// always execute contents of opkg_commands-file
m_filesToUpdate.clear();
m_filesToUpdate << "etc/psa_update/opkg_commands";
execOpkgCommands();
}
return;
}
m_versionInfo = m_gc.gitShowReason(m_branchName);
@ -470,6 +478,14 @@ void Worker::privateUpdate() {
//
////////////////////////////////////////////////////////////////////////////
if ((continueUpdate = filesToUpdate()) == false) {
// even if something goes wrong in filesToUpdate, try to execute
// opkg_commands
if (QDir(m_customerRepository).exists()) {
// always execute contents of opkg_commands-file
m_filesToUpdate.clear();
m_filesToUpdate << "etc/psa_update/opkg_commands";
execOpkgCommands();
}
return;
}
m_versionInfo = m_gc.gitShowReason(m_branchName);
@ -483,6 +499,14 @@ void Worker::privateUpdate() {
//
////////////////////////////////////////////////////////////////////////////
if ((continueUpdate = syncCustomerRepositoryAndFS()) == false) {
// even if something goes wrong with rsync, try to execute
// opkg_commands
if (QDir(m_customerRepository).exists()) {
// always execute contents of opkg_commands-file
m_filesToUpdate.clear();
m_filesToUpdate << "etc/psa_update/opkg_commands";
execOpkgCommands();
}
return;
}
lst = QStringList(QString(smap[UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS]));