Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix update #1624

Merged
merged 2 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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