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:48:20 +02:00
parent 6b78ebcacb
commit a8637461bb
+3 -17
View File
@@ -501,11 +501,7 @@ class OpenWrtSystemMixin:
# 1. LLDP daemon
lldpd_path = self._send_command("which lldpd 2>/dev/null").strip()
if not lldpd_path:
warnings.append({
"code": "lldpd_not_installed",
"severity": "warning",
"action": "install_lldpd",
})
warnings.append({"code": "lldpd_not_installed"})
pm = self._pm_type()
@@ -538,8 +534,6 @@ class OpenWrtSystemMixin:
pkg_names = [_pkg_name(ln, pm) for ln in upgradable]
warnings.append({
"code": "updates_available",
"severity": "info",
"action": None,
"meta": {
"count": len(upgradable),
"packages": pkg_names[:10],
@@ -550,20 +544,12 @@ class OpenWrtSystemMixin:
if pm == "opkg":
auc_path = self._send_command("which auc 2>/dev/null").strip()
if not auc_path:
warnings.append({
"code": "update_notifications_disabled",
"severity": "warning",
"action": "install_auc",
})
warnings.append({"code": "update_notifications_disabled"})
# 4. base64 not available — needed for efficient config apply
b64_path = self._send_command("command -v base64 2>/dev/null").strip()
if not b64_path:
warnings.append({
"code": "no_base64",
"severity": "warning",
"action": "install_coreutils_base64",
})
warnings.append({"code": "no_base64"})
return warnings