install_package still reads success from keywords; ruff/mypy debt; uninstall contract mismatch #4

Open
opened 2026-09-25 12:43:56 +00:00 by christianmanivong · 0 comments
Owner

Follow-up from #2 (uninstall success by exit status, netork#267).

install_package still decides success by searching the output of ... || true commands for keywords — the pattern #2 replaced for uninstall_package. It should use _sudo_status and the exit status the same way.

Related, found at the same time:

  • napalm_linux/linux.py does not pass ruff or mypy: ~45 ruff / ~41 mypy findings, almost all F821 undefined Dict/List/Optional in annotations (e.g. lines 452, 600, 723, 958, 1167, 1280, 2024, 2405; works at runtime only because of from __future__ import annotations), plus F841 (~1392), F541 (~2255) and implicit-Optional at 768/771.
  • Contract mismatch: napalm_device_types/packages.py documents uninstall_package(name) -> None raising on failure, while the Linux, OpenWrt and OPNsense drivers and netOrk's adapter base (netork/adapters/napalm/base.py:119) return {"success", "output"}.
Follow-up from #2 (uninstall success by exit status, netork#267). `install_package` still decides success by searching the output of `... || true` commands for keywords — the pattern #2 replaced for `uninstall_package`. It should use `_sudo_status` and the exit status the same way. Related, found at the same time: - `napalm_linux/linux.py` does not pass ruff or mypy: ~45 ruff / ~41 mypy findings, almost all F821 undefined `Dict`/`List`/`Optional` in annotations (e.g. lines 452, 600, 723, 958, 1167, 1280, 2024, 2405; works at runtime only because of `from __future__ import annotations`), plus F841 (~1392), F541 (~2255) and implicit-Optional at 768/771. - Contract mismatch: `napalm_device_types/packages.py` documents `uninstall_package(name) -> None` raising on failure, while the Linux, OpenWrt and OPNsense drivers and netOrk's adapter base (`netork/adapters/napalm/base.py:119`) return `{"success", "output"}`.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NAPALM/napalm-linux#4