ausfuehrer: Nur-Lesen-Modus (nur Bericht, jeder andere Auftrag abgelehnt), wahlweise bei der Einrichtung

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hitonabi
2026-09-24 18:52:36 +02:00
co-authored by Claude Opus 5.5
parent 209549f0f3
commit b452b5e672
3 changed files with 25 additions and 4 deletions
+12
View File
@@ -277,3 +277,15 @@ def test_docker_ueber_arcane_erst_als_probelauf(ausfuehrer, monkeypatch):
assert meldungen[-1][0] == "Arcane-Probelauf: 1 von 7 Containern würden aktualisiert (nerdquiz). Geändert wurde nichts."
monkeypatch.delenv("MC_ARCANE_KEY")
assert updates.starten("vm-106", "docker")["ok"] is False
def test_ausfuehrer_nur_lesen(monkeypatch):
a = _ausfuehrer_modul()
monkeypatch.setattr(a, "NUR_LESEN", True)
monkeypatch.setattr(a, "_pvesh", lambda pfad, *p: [{"vmid": 104, "type": "lxc", "tags": "community-script"}])
ausgefuehrt: list[list[str]] = []
monkeypatch.setattr(a, "_laufen", lambda befehl, zeitlimit=60: ausgefuehrt.append(befehl) or (0, "ok"))
antwort = a.ausfuehren({"aktion": "update", "parameter": {"vmid": 104}})
assert antwort["code"] == 2 and "Nur-Lesen" in antwort["text"] and ausgefuehrt == []
monkeypatch.setattr(a, "bericht", lambda: {"gaeste": []})
assert a.ausfuehren({"aktion": "bericht", "parameter": {}})["code"] == 0