homelab: Ausfuehrer erkennt die App auch am neuen /usr/bin/update (SCRIPT_SLUG), das Community-Scripts nach jedem Update schreibt
Nach dem ersten echten Update (Gitea 1.27.2 -> 1.27.3) stand Gitea nur noch als "gitea" ohne App-Baustein da. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
528198de60
commit
4a2b1723f4
@@ -348,3 +348,14 @@ def test_apps_mit_eigenem_updater_bekommen_keinen_knopf(daten, monkeypatch):
|
||||
assert adguard["zustand"] == "neu" and adguard["aktion"] is None and "eigene Oberfläche" in adguard["grund"]
|
||||
antwort = updates.starten("ct-103", "app")
|
||||
assert antwort["ok"] is False and "Community-Script" in antwort["detail"]
|
||||
|
||||
|
||||
def test_ausfuehrer_erkennt_beide_formate_von_update():
|
||||
"""Nach dem ersten echten Update (Gitea, 24.09.2026) schrieb das Community-Script /usr/bin/update neu."""
|
||||
a = _ausfuehrer_modul()
|
||||
alt = 'bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/adguard.sh)"'
|
||||
neu = ('#!/usr/bin/env bash\nexport SCRIPT_SLUG="gitea"\nexport UPDATE_SCRIPT_NAME="gitea"\n'
|
||||
'bash -c "$(curl -fsSL "${COMMUNITY_SCRIPTS_URL}/ct/${UPDATE_SCRIPT_NAME}.sh")"\n')
|
||||
assert a.app_kennung_aus(alt) == "adguard"
|
||||
assert a.app_kennung_aus(neu) == "gitea"
|
||||
assert a.app_kennung_aus("") is None
|
||||
|
||||
@@ -112,13 +112,20 @@ def snapshot_moeglich(konfig: dict, arten: dict[str, str]) -> tuple[bool, str |
|
||||
return True, None
|
||||
|
||||
|
||||
def _app_kennung(vmid: int) -> str | None:
|
||||
"""Welches Community-Script steckt im Gast? /usr/bin/update lädt ct/<kennung>.sh."""
|
||||
code, text = _im_gast(vmid, "cat /usr/bin/update 2>/dev/null", 10)
|
||||
m = re.search(r"/ct/([a-z0-9-]+)\.sh", text) if code == 0 else None
|
||||
def app_kennung_aus(update_skript: str) -> str | None:
|
||||
"""Kennung des Community-Scripts aus /usr/bin/update. Zwei Formate: das alte lädt ct/<kennung>.sh direkt,
|
||||
das neue (schreibt jedes erfolgreiche Update seit 09/2026) setzt `export SCRIPT_SLUG="<kennung>"`."""
|
||||
m = (re.search(r'^export (?:SCRIPT_SLUG|UPDATE_SCRIPT_NAME)="([a-z0-9-]+)"', update_skript, re.MULTILINE)
|
||||
or re.search(r"/ct/([a-z0-9-]+)\.sh", update_skript))
|
||||
return m.group(1) if m else None
|
||||
|
||||
|
||||
def _app_kennung(vmid: int) -> str | None:
|
||||
"""Welches Community-Script steckt im Gast?"""
|
||||
code, text = _im_gast(vmid, "cat /usr/bin/update 2>/dev/null", 10)
|
||||
return app_kennung_aus(text) if code == 0 else None
|
||||
|
||||
|
||||
def _app_version(vmid: int, kennung: str) -> str | None:
|
||||
befehl = VERSION_PROBEN.get(kennung)
|
||||
if befehl is None:
|
||||
|
||||
Reference in New Issue
Block a user