Skip to content

Commit

Permalink
Merge pull request #1624 from benderl/fix-update
Browse files Browse the repository at this point in the history
Fix update
  • Loading branch information
benderl committed May 17, 2024
2 parents f5d5a37 + 117f2bf commit 552f083
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 28 deletions.
53 changes: 26 additions & 27 deletions packages/helpermodules/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,34 +634,33 @@ def systemUpdate(self, connection_id: str, payload: dict) -> None:
log.info("Update requested")
# notify system about running update, notify about end update in script
Pub().pub("openWB/system/update_in_progress", True)
try:
if SubData.system_data["system"].data["backup_before_update"]:
if SubData.system_data["system"].data["backup_before_update"]:
try:
self.createCloudBackup(connection_id, {})
except Exception:
pub_user_message(payload, connection_id,
("Fehler beim Erstellen der Cloud-Sicherung."
f" {traceback.format_exc()}<br />Update abgebrochen!"
"Bitte Fehlerstatus überprüfen!. " +
"Option Sicherung vor System Update kann unter Datenverwaltung deaktiviert werden."),
MessageType.WARNING)
Pub().pub("openWB/system/update_in_progress", False)
return
if SubData.system_data["system"].data["update_in_progress"]:
parent_file = Path(__file__).resolve().parents[2]
if "branch" in payload["data"] and "tag" in payload["data"]:
pub_user_message(
payload, connection_id,
f'Wechsel auf Zweig \'{payload["data"]["branch"]}\' Tag \'{payload["data"]["tag"]}\' gestartet.',
MessageType.SUCCESS)
subprocess.run([
str(parent_file / "runs" / "update_self.sh"),
str(payload["data"]["branch"]),
str(payload["data"]["tag"])])
else:
pub_user_message(payload, connection_id, "Update gestartet.", MessageType.INFO)
subprocess.run([
str(parent_file / "runs" / "update_self.sh"),
SubData.system_data["system"].data["current_branch"]])
except Exception:
pub_user_message(payload, connection_id,
("Fehler beim Erstellen der Cloud-Sicherung."
f" {traceback.format_exc()}<br />Update abgebrochen!"
"Bitte Fehlerstatus überprüfen!. " +
"Option Sicherung vor System Update kann unter Datenverwaltung deaktiviert werden."),
MessageType.WARNING)
Pub().pub("openWB/system/update_in_progress", False)
return
parent_file = Path(__file__).resolve().parents[2]
if "branch" in payload["data"] and "tag" in payload["data"]:
pub_user_message(
payload, connection_id,
f'Wechsel auf Zweig \'{payload["data"]["branch"]}\' Tag \'{payload["data"]["tag"]}\' gestartet.',
MessageType.SUCCESS)
subprocess.run([
str(parent_file / "runs" / "update_self.sh"),
str(payload["data"]["branch"]),
str(payload["data"]["tag"])])
else:
pub_user_message(payload, connection_id, "Update gestartet.", MessageType.INFO)
subprocess.run([
str(parent_file / "runs" / "update_self.sh"),
SubData.system_data["system"].data["current_branch"]])

def systemFetchVersions(self, connection_id: str, payload: dict) -> None:
log.info("Fetch versions requested")
Expand Down
2 changes: 1 addition & 1 deletion runs/update_available_versions.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
OPENWBBASEDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
LOGFILE="${OPENWBBASEDIR}/data/log/update.log"
LOGFILE="${OPENWBBASEDIR}/ramdisk/versions.log"
GITREMOTE="origin"
YOURCHARGEPREFIX="yc/"

Expand Down

0 comments on commit 552f083

Please sign in to comment.