fix(dhcp): one refused reservation no longer stops the apply #104

Merged
christianmanivong merged 2 commits from fix/dhcp-reservations-partial-apply into main 2026-11-11 21:12:31 +00:00
Owner

apply_dhcp_reservationset committed only after the last write, so one write the device refused (OPNsense: an address in a subnet Kea does not manage) ended the run before the commit. Later reservations went unwritten; earlier ones stayed saved but inactive, and the next diff found them configured and never committed them.

  • A refused change gets a [failed] <mac> -> <ip>: <reason> line; the others are still written.
  • Any non-empty diff commits, also one whose every write was refused, so writes an interrupted run saved take effect.
  • DhcpApplyError (a RuntimeError, exported) is raised after the commit with how many of how many were refused.

4.35.1. Tests: TestApplyWithARefusedReservation; full suite, ruff and mypy green.

Refs NetOrk/netork#2381

`apply_dhcp_reservationset` committed only after the last write, so one write the device refused (OPNsense: an address in a subnet Kea does not manage) ended the run before the commit. Later reservations went unwritten; earlier ones stayed saved but inactive, and the next diff found them configured and never committed them. - A refused change gets a `[failed] <mac> -> <ip>: <reason>` line; the others are still written. - Any non-empty diff commits, also one whose every write was refused, so writes an interrupted run saved take effect. - `DhcpApplyError` (a `RuntimeError`, exported) is raised after the commit with how many of how many were refused. 4.35.1. Tests: `TestApplyWithARefusedReservation`; full suite, ruff and mypy green. Refs NetOrk/netork#2381
christianmanivong added 1 commit 2026-11-11 21:03:59 +00:00
fix(dhcp): one refused reservation no longer stops the apply
driver / lint (pull_request) Successful in 18s
driver / standard (pull_request) Failing after 22s
driver / types (pull_request) Successful in 1m22s
driver / test (3.12) (pull_request) Successful in 1m28s
driver / test (3.13) (pull_request) Successful in 1m26s
driver / lowest (pull_request) Successful in 38s
driver / build (pull_request) Successful in 38s
driver / security (pull_request) Successful in 1m11s
CI / driver (pull_request) Failing after 2m57s
driver / publish (pull_request) Skipped
c74173523a
apply_dhcp_reservationset wrote the diff one reservation at a time and
committed only after the last. A write the device refused -- on
OPNsense, an address in a subnet Kea does not manage -- ended the run
before the commit: every later reservation went unwritten, and the
earlier ones stayed saved but inactive. The next diff read those back as
configured, reported no changes and never committed them.

A refused change now gets a "[failed] <mac> -> <ip>: <reason>" line and
the others are still written. Any non-empty diff commits, also one whose
every write was refused, so writes an interrupted earlier run saved take
effect. DhcpApplyError (a RuntimeError, exported) is raised after the
commit with how many of how many changes were refused.

Refs NetOrk/netork#2381
christianmanivong added 1 commit 2026-11-11 21:08:51 +00:00
refactor(dhcp): one reservation's write in a helper of its own
driver / standard (pull_request) Successful in 17s
driver / lint (pull_request) Successful in 15s
driver / types (pull_request) Successful in 1m6s
driver / test (3.12) (pull_request) Successful in 1m19s
driver / test (3.13) (pull_request) Successful in 1m10s
driver / lowest (pull_request) Successful in 42s
driver / build (pull_request) Successful in 37s
driver / security (pull_request) Successful in 1m9s
CI / driver (pull_request) Successful in 3m0s
driver / publish (pull_request) Skipped
8516f2a1ee
apply_dhcp_reservationset grew to 59 lines with the per-write handling;
the quality ratchet allows no new function that long.

Refs NetOrk/netork#2381
christianmanivong merged commit 08a62838f7 into main 2026-11-11 21:12:31 +00:00
christianmanivong deleted branch fix/dhcp-reservations-partial-apply 2026-11-11 21:12:31 +00:00
Sign in to join this conversation.