fix(access-point): a change the AP refuses in apply_ap_config is raised, and nothing applied (#54)
driver / standard (pull_request) Successful in 16s
driver / lint (pull_request) Successful in 11s
driver / lowest (pull_request) Successful in 28s
driver / types (pull_request) Successful in 1m4s
driver / test (3.13) (pull_request) Successful in 54s
driver / test (3.12) (pull_request) Successful in 1m8s
driver / build (pull_request) Successful in 28s
driver / security (pull_request) Successful in 59s
CI / driver (pull_request) Successful in 2m8s
driver / publish (pull_request) Skipped

The configuration ran as one detached script, so a refused uci step
only reached its log while the call reported the part as applied. The
changes are now staged by a script the call waits for: a uci wrapper
records each refused set, add, add_list or delete with its part, and at
the end every config is reverted and the script exits 3, which raises
CommandErrorException naming each part, passphrases masked. Quiet -q
calls stay tests. The commits, LuCI's service, the reloads and the
restart run detached afterwards, as before.

Closes #54
This commit is contained in:
Christian Manivong committed 2026-11-29 22:43:34 +01:00
1 parent f71c12dfb6
commit 9bac9bd1af
6 files changed
+350 -98

No files matched your search

+16 -7
View File
@@ -176,7 +176,7 @@ reverted, and nothing is committed or restarted.
## AP configuration
`apply_ap_config(config, parts)` (napalm-device-types `ApConfigMixin`) writes the parts of
an `ApConfigDict` the caller names as one shell script: the radios (country, 5 and 2.4
an `ApConfigDict` the caller names as UCI changes: the radios (country, 5 and 2.4
GHz `htmode`), remote syslog, LuCI (`uhttpd` enabled or stopped), dropbear's port and
password logins, the `br-ap` bridge with VLAN filtering on `eth0` (every VLAN tagged, the
management VLAN untagged where asked), one VLAN of it, its spanning tree, and per SSID its
@@ -185,12 +185,21 @@ VLAN (`ap_vlan<vid>`), bands, presence, encryption and key, flags, limits, MAC f
written without its key, a whitelist without MACs is written as no filter, and a part the
driver does not know or whose values are missing comes back in `skipped`.
The script is written as root from stdin into a fresh `mktemp -d` directory
(`/tmp/openwrt-apply.XXXXXX`) and run detached, since it may cut the session; its output
stays in `apply.log` there. Rebuilding the bridge restarts the AP (`restarts`); otherwise
the configs are committed and network, wifi, system, dropbear and the firewall reloaded as
needed. The result carries the script with every passphrase masked. A step that fails
inside the script is in the log, not raised: the script has left the session by then.
Two scripts are written as root from stdin into a fresh `mktemp -d` directory
(`/tmp/openwrt-apply.XXXXXX`):
- `stage.sh` stages the changes without committing them, so the running AP is untouched,
and the call waits for it. A change `uci` refuses (`set`, `add`, `add_list`, `delete`,
...) is recorded with its part; at the end every config is reverted and the call raises
`CommandErrorException` naming each refused part and what `uci` said, passphrases
masked. Nothing of the configuration is applied then (NAPALM/napalm-openwrt#54). A quiet
`uci -q` call, such as deleting an option that may be missing, is no refusal. The script
removes itself as it starts, since it holds the passphrases.
- `apply.sh` commits, enables or stops LuCI, and reloads network, wifi, system, dropbear and
the firewall as needed, or restarts the AP when the bridge was rebuilt (`restarts`). It
runs detached, since it may cut the session; its output stays in `apply.log` there.
The result carries both scripts with every passphrase masked.
## Time sync