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