package commands, UCI parsing: copies inside the driver; dead _action_fix_snmp #5

Closed
opened 2026-10-06 17:31:30 +00:00 by christianmanivong · 0 comments
Owner

Package commands. The "apk or opkg command, clean the output, check failure markers" sequence appears five times:

  • packages_mixin.py:196, :209
  • openwrt.py:607, :620, :629

The marker tuple ("error:", "failed", "not found", "unknown package") is repeated each time.

Dead code. OpenWrtSystemMixin._action_fix_snmp (system_mixin.py:247) is shadowed by OpenWrtDriver._action_fix_snmp (openwrt.py:472), because the class's own method wins in the MRO. The mixin copy is never called. It also uses a shorter marker tuple (:264).

UCI. There are two UCI tokenisers and two section parsers:

  • openwrt.py:292–326 handles '…', "…" and bare tokens.
  • vlan_mixin.py:20–74 handles single quotes only and network sections only.

Proposal: _pkg_run(apk_cmd, opkg_cmd, *, refresh=False) -> (success, output); delete the mixin's _action_fix_snmp; a uci.py that keeps the openwrt.py tokeniser.

Prio P4.

From the NetOrk function index (NetOrk/netork#670); every location was checked against the current code. Paths are relative to each driver repo.

**Package commands.** The "apk or opkg command, clean the output, check failure markers" sequence appears five times: - `packages_mixin.py`:196, :209 - `openwrt.py`:607, :620, :629 The marker tuple `("error:", "failed", "not found", "unknown package")` is repeated each time. **Dead code.** `OpenWrtSystemMixin._action_fix_snmp` (`system_mixin.py`:247) is shadowed by `OpenWrtDriver._action_fix_snmp` (`openwrt.py`:472), because the class's own method wins in the MRO. The mixin copy is never called. It also uses a shorter marker tuple (:264). **UCI.** There are two UCI tokenisers and two section parsers: - `openwrt.py`:292–326 handles `'…'`, `"…"` and bare tokens. - `vlan_mixin.py`:20–74 handles single quotes only and network sections only. **Proposal:** `_pkg_run(apk_cmd, opkg_cmd, *, refresh=False) -> (success, output)`; delete the mixin's `_action_fix_snmp`; a `uci.py` that keeps the `openwrt.py` tokeniser. Prio P4. From the NetOrk function index (NetOrk/netork#670); every location was checked against the current code. Paths are relative to each driver repo.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NAPALM/napalm-openwrt#5