refactor(warnings): report raw signal only, no severity/presentation

get_device_warnings() now returns only {code, meta} — severity, title,
message, and action are resolved centrally by netork's
WARNING_CATALOG (netork/core/device_warnings.py), not by the driver.
Keeps this driver independent of netork and avoids per-vendor drift in
how the same warning code is presented.
This commit is contained in:
Christian Manivong
2026-07-20 09:49:38 +02:00
parent 38f0c0a656
commit 39f8d80352
+2 -18
View File
@@ -288,11 +288,7 @@ class ProxmoxSystemMixin:
try: try:
lldpd_path = self._exec_ssh_command("command -v lldpd 2>/dev/null").strip() lldpd_path = self._exec_ssh_command("command -v lldpd 2>/dev/null").strip()
if not lldpd_path: if not lldpd_path:
warnings.append({ warnings.append({"code": "lldpd_not_installed"})
"code": "lldpd_not_installed",
"severity": "warning",
"action": "install_lldpd",
})
except Exception as exc: except Exception as exc:
logger.debug("Failed to check for lldpd: %s", exc) logger.debug("Failed to check for lldpd: %s", exc)
@@ -302,13 +298,6 @@ class ProxmoxSystemMixin:
if updates: if updates:
warnings.append({ warnings.append({
"code": "updates_available", "code": "updates_available",
"severity": "warning",
"title": (
f"{len(updates)} package update"
f"{'s' if len(updates) != 1 else ''} available"
),
"message": None,
"action": None,
"meta": { "meta": {
"count": len(updates), "count": len(updates),
"packages": [u["name"] for u in updates], "packages": [u["name"] for u in updates],
@@ -322,12 +311,7 @@ class ProxmoxSystemMixin:
sub = self._get_node_subscription() sub = self._get_node_subscription()
status = sub.get("status", "") status = sub.get("status", "")
if status in ("NotFound", "Invalid", "Expired"): if status in ("NotFound", "Invalid", "Expired"):
warnings.append({ warnings.append({"code": "no_subscription", "meta": {"status": status}})
"code": "no_subscription",
"severity": "warning",
"action": None,
"meta": {"status": status},
})
except Exception as exc: except Exception as exc:
logger.debug("Failed to check subscription status: %s", exc) logger.debug("Failed to check subscription status: %s", exc)