feat!: fix templates with the caller's values replace run_device_action (0.8.0) #31

Merged
christianmanivong merged 5 commits from feat/fix-templates-27 into master 2026-10-16 23:17:15 +00:00
Owner

Step 4 of NetOrk/netork#1105. Needs NAPALM/napalm-device-types#41 (4.12).

  • configure_snmp_agent(settings): install net-snmp, snmpd.conf with one rocommunity line per allowed source, udp/161 opened in ufw/iptables only for those sources, snmpd enabled and restarted; each step judged by its exit status. Community/sources/text that would break the file are refused.
  • configure_package_proxy(url) (apt 00proxy, "" removes it), grant_container_engine_access(user), ensure_package(name) (from the base package).
  • run_device_action, the four _action_* methods and the unused apt_update_upgrade are gone. No application value is built in any more (public, Managed by netOrk, netork@localhost, the /24 guessed from ss).
  • The sudo hint names no application settings.
  • Separate commit: the annotations resolve (Dict/List/Optional imported), with a regression test.

Merge order: together with the netOrk side of NetOrk/netork#1109 and the pin bump — netOrk today calls run_device_action("fix_snmp" | "fix_apt_proxy" | "fix_docker_permissions").

Inherited by napalm-openmediavault and napalm-qnap-qts: QNAP must opt out (= None) of configure_snmp_agent, configure_package_proxy, ensure_package (NAPALM/napalm-qnap-qts#7); OMV may need its own configure_snmp_agent (NAPALM/napalm-openmediavault#6).

Closes #27, closes #29

Step 4 of NetOrk/netork#1105. Needs NAPALM/napalm-device-types#41 (4.12). - `configure_snmp_agent(settings)`: install net-snmp, `snmpd.conf` with one `rocommunity` line per allowed source, udp/161 opened in ufw/iptables **only for those sources**, snmpd enabled and restarted; each step judged by its exit status. Community/sources/text that would break the file are refused. - `configure_package_proxy(url)` (apt `00proxy`, `""` removes it), `grant_container_engine_access(user)`, `ensure_package(name)` (from the base package). - `run_device_action`, the four `_action_*` methods and the unused `apt_update_upgrade` are gone. No application value is built in any more (`public`, `Managed by netOrk`, `netork@localhost`, the /24 guessed from `ss`). - The sudo hint names no application settings. - Separate commit: the annotations resolve (`Dict`/`List`/`Optional` imported), with a regression test. **Merge order:** together with the netOrk side of NetOrk/netork#1109 and the pin bump — netOrk today calls `run_device_action("fix_snmp" | "fix_apt_proxy" | "fix_docker_permissions")`. **Inherited by** napalm-openmediavault and napalm-qnap-qts: QNAP must opt out (`= None`) of `configure_snmp_agent`, `configure_package_proxy`, `ensure_package` (NAPALM/napalm-qnap-qts#7); OMV may need its own `configure_snmp_agent` (NAPALM/napalm-openmediavault#6). Closes #27, closes #29
christianmanivong added 3 commits 2026-10-16 10:09:06 +00:00
The driver filled run_device_action with an application's remediations
and their values: community "public", "Managed by netOrk", the
caller's address guessed from ss and a /24 ufw rule, the proxy from an
optional_args key.

It implements napalm-device-types' fix templates instead (4.12), and
the caller supplies every value:

- configure_snmp_agent(settings): net-snmp installed, snmpd.conf with
  one rocommunity line per allowed source, udp/161 opened in ufw or
  iptables for those sources only, snmpd enabled and restarted. Every
  step reads its exit status. A community, source or text that would
  break the file is refused.
- configure_package_proxy(url): apt's 00proxy, or removed for "".
- grant_container_engine_access(user): usermod -aG docker for the user
  named.
- ensure_package(name): from the base package, over get_packages and
  install_package.

run_device_action, its four _action_* methods and the unused
apt_update_upgrade are gone. The sudo hint no longer names an
application's settings.

BREAKING CHANGE: run_device_action is removed; callers use the
templates. Requires napalm-device-types 4.12.

Closes #27
Dict, List and Optional were used in 30 annotations without an import;
from __future__ import annotations kept that from failing until
something resolved them (typing.get_type_hints raised NameError).

Closes #29
chore: release 0.8.0 (napalm-device-types 4.12)
CI / test (3.10) (push) Failing after 18s
CI / test (3.11) (push) Failing after 15s
CI / test (3.12) (push) Failing after 18s
CI / test (3.10) (pull_request) Failing after 16s
CI / test (3.11) (pull_request) Failing after 15s
CI / test (3.12) (pull_request) Failing after 19s
1bc54b66e8
christianmanivong added 1 commit 2026-10-16 13:19:05 +00:00
feat: get_management_peer, the address the host sees the SSH connection come from
CI / test (3.10) (push) Failing after 16s
CI / test (3.11) (push) Failing after 14s
CI / test (3.12) (push) Failing after 16s
CI / test (3.10) (pull_request) Failing after 15s
CI / test (3.11) (pull_request) Failing after 14s
CI / test (3.12) (pull_request) Failing after 15s
ec8668476a
From SSH_CONNECTION's client side; None when it is empty or no address.
The caller uses it to choose the sources an SNMP agent answers.
christianmanivong added 1 commit 2026-10-16 23:07:06 +00:00
chore: require napalm-device-types 4.13, where the fix templates landed
CI / test (3.10) (push) Successful in 28s
CI / test (3.11) (push) Successful in 28s
CI / test (3.12) (push) Successful in 33s
CI / test (3.10) (pull_request) Successful in 34s
CI / test (3.11) (pull_request) Successful in 30s
CI / test (3.12) (pull_request) Successful in 34s
fc968fab44
christianmanivong force-pushed feat/fix-templates-27 from 8441110975 to fc968fab44 2026-10-16 23:07:06 +00:00 Compare
christianmanivong merged commit 40f6ecd583 into master 2026-10-16 23:17:15 +00:00
christianmanivong deleted branch feat/fix-templates-27 2026-10-16 23:17:15 +00:00
Sign in to join this conversation.