homelab: eigener Container nicht in der Geraeteliste, Geheimnis beim Einrichten richtig anstossen, Deploy zieht den Homelab-Teil mit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hitonabi
2026-09-24 19:01:20 +02:00
co-authored by Claude Opus 5.5
parent b452b5e672
commit 39320b446d
5 changed files with 37 additions and 4 deletions
+3 -1
View File
@@ -24,6 +24,7 @@ from services.homelab import apps, arcane, kanal
BERICHT_ALT_S = 30 * 60
LISTEN_ALT_S = 14 * 24 * 3600
EIGENES_ETIKETT = "mc2"
ERREICHBAR_CACHE_S = 60
_erreichbar_cache: dict[str, tuple[float, bool]] = {}
@@ -217,7 +218,8 @@ def ziele() -> dict:
return {"ziele": [], "bericht": None, "ausfuehrer": ausfuehrer}
b = eingang["bericht"]
liste = [_host_ziel(b.get("host") or {})]
liste += [_gast_ziel(g, jetzt) for g in b.get("gaeste") or []]
# Der Container des Orchestrators selbst (Etikett „mc2“) ist kein Gerät, das er pflegt.
liste += [_gast_ziel(g, jetzt) for g in b.get("gaeste") or [] if EIGENES_ETIKETT not in (g.get("etiketten") or [])]
for z in liste:
z.geprueft = eingang["empfangen"]
return {"ziele": [z.als_dict() for z in liste],
+8
View File
@@ -289,3 +289,11 @@ def test_ausfuehrer_nur_lesen(monkeypatch):
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
def test_eigener_container_erscheint_nicht(daten):
bericht = json.loads(json.dumps(BERICHT))
bericht["gaeste"].append({"vmid": 107, "art": "lxc", "name": "homelab-orchestrator", "status": "running",
"etiketten": ["mc2"], "erlaubt": False, "ip": "192.168.178.31"})
kanal.bericht_speichern(bericht)
assert "ct-107" not in {z["id"] for z in inventar.ziele()["ziele"]}