create_dhcp_reservation (napalm_opnsense/opnsense.py 1433-1517) looks for an existing reservation for the IP so a retry updates it instead of adding a second one. If that search fails, it logs at debug level and goes on (line 1490):
logger.debug("Kea reservation search failed, proceeding to add: %s",exc)
With existing_row still None, it posts to /api/kea/dhcpv4/addReservation (line 1511). If a reservation for the IP exists — the case the search is there for (a retried VM provisioning, netOrk's _push_and_record_reservation) — the add is rejected and the caller gets "Kea rejected DHCP reservation for …" instead of the search error; if OPNsense's model accepts it, a second reservation for the same IP is written, which the code's own comment says Kea refuses to load. Either way the failed read is invisible (debug level) and a write follows a read that did not happen.
Related: #26 (the search matches on IP only). Separate cause.
Expected
A failed searchReservation raises (RuntimeError naming the search), before anything is written. Test-first: searchReservation raising → create_dhcp_reservation raises and never posts addReservation.
Priority: P3 — a write on the DHCP server based on a read that failed.
Found during the bug sweep of 2026-11-01.
## What happens
`create_dhcp_reservation` (`napalm_opnsense/opnsense.py` 1433-1517) looks for an existing reservation for the IP so a retry updates it instead of adding a second one. If that search fails, it logs at debug level and goes on (line 1490):
```python
logger.debug("Kea reservation search failed, proceeding to add: %s", exc)
```
With `existing_row` still `None`, it posts to `/api/kea/dhcpv4/addReservation` (line 1511). If a reservation for the IP exists — the case the search is there for (a retried VM provisioning, netOrk's `_push_and_record_reservation`) — the add is rejected and the caller gets "Kea rejected DHCP reservation for …" instead of the search error; if OPNsense's model accepts it, a second reservation for the same IP is written, which the code's own comment says Kea refuses to load. Either way the failed read is invisible (debug level) and a write follows a read that did not happen.
Related: #26 (the search matches on IP only). Separate cause.
## Expected
A failed `searchReservation` raises (`RuntimeError` naming the search), before anything is written. Test-first: `searchReservation` raising → `create_dhcp_reservation` raises and never posts `addReservation`.
Priority: P3 — a write on the DHCP server based on a read that failed.
Found during the bug sweep of 2026-11-01.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What happens
create_dhcp_reservation(napalm_opnsense/opnsense.py1433-1517) looks for an existing reservation for the IP so a retry updates it instead of adding a second one. If that search fails, it logs at debug level and goes on (line 1490):With
existing_rowstillNone, it posts to/api/kea/dhcpv4/addReservation(line 1511). If a reservation for the IP exists — the case the search is there for (a retried VM provisioning, netOrk's_push_and_record_reservation) — the add is rejected and the caller gets "Kea rejected DHCP reservation for …" instead of the search error; if OPNsense's model accepts it, a second reservation for the same IP is written, which the code's own comment says Kea refuses to load. Either way the failed read is invisible (debug level) and a write follows a read that did not happen.Related: #26 (the search matches on IP only). Separate cause.
Expected
A failed
searchReservationraises (RuntimeErrornaming the search), before anything is written. Test-first:searchReservationraising →create_dhcp_reservationraises and never postsaddReservation.Priority: P3 — a write on the DHCP server based on a read that failed.
Found during the bug sweep of 2026-11-01.