_detect_active_dns (napalm_opnsense/opnsense.py 2809-2819) catches every exception from /api/core/service/search, logs a warning (line 2818) and returns None:
logger.warning("DNS service detection failed: %s",exc)
Its callers cannot tell a failed request from "neither Unbound nor Dnsmasq runs":
get_dns_entries() (line 2842) returns []. netOrk treats an empty answer as "read, none" and removes the device's DNS records (netork/jobs/tasks/poll/_dns_entries.py: "an empty answer removes them"; a raised error would have kept them, #1458). One transient API error during a poll therefore wipes the firewall's records in netOrk until the next poll.
sync_dns_zone (line 2981-2983) raises "No active DNS service (Unbound or Dnsmasq) detected", which sends the operator looking at the DNS service instead of the API error.
Related: #14 (the host-override readers swallow errors and return [], which makes sync_dns_zone duplicate overrides). That fix covers the readers; this one is the detection in front of them, and the same [] reaches get_dns_entries.
Expected
_detect_active_dns lets the request error propagate (or raises its own ConnectionException with the cause); None only when the search succeeded and neither service runs. Test-first: a failing service/search makes get_dns_entries() raise and sync_dns_zone report the API error.
Priority: P3 — DNS records disappear from netOrk after any transient API error, and the sync error names the wrong cause.
Found during the bug sweep of 2026-11-01.
## What happens
`_detect_active_dns` (`napalm_opnsense/opnsense.py` 2809-2819) catches every exception from `/api/core/service/search`, logs a warning (line 2818) and returns `None`:
```python
logger.warning("DNS service detection failed: %s", exc)
```
Its callers cannot tell a failed request from "neither Unbound nor Dnsmasq runs":
- `get_dns_entries()` (line 2842) returns `[]`. netOrk treats an empty answer as "read, none" and removes the device's DNS records (`netork/jobs/tasks/poll/_dns_entries.py`: "an empty answer removes them"; a raised error would have kept them, #1458). One transient API error during a poll therefore wipes the firewall's records in netOrk until the next poll.
- `sync_dns_zone` (line 2981-2983) raises `"No active DNS service (Unbound or Dnsmasq) detected"`, which sends the operator looking at the DNS service instead of the API error.
Related: #14 (the host-override readers swallow errors and return `[]`, which makes `sync_dns_zone` duplicate overrides). That fix covers the readers; this one is the detection in front of them, and the same `[]` reaches `get_dns_entries`.
## Expected
`_detect_active_dns` lets the request error propagate (or raises its own `ConnectionException` with the cause); `None` only when the search succeeded and neither service runs. Test-first: a failing `service/search` makes `get_dns_entries()` raise and `sync_dns_zone` report the API error.
Priority: P3 — DNS records disappear from netOrk after any transient API error, and the sync error names the wrong cause.
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
_detect_active_dns(napalm_opnsense/opnsense.py2809-2819) catches every exception from/api/core/service/search, logs a warning (line 2818) and returnsNone:Its callers cannot tell a failed request from "neither Unbound nor Dnsmasq runs":
get_dns_entries()(line 2842) returns[]. netOrk treats an empty answer as "read, none" and removes the device's DNS records (netork/jobs/tasks/poll/_dns_entries.py: "an empty answer removes them"; a raised error would have kept them, #1458). One transient API error during a poll therefore wipes the firewall's records in netOrk until the next poll.sync_dns_zone(line 2981-2983) raises"No active DNS service (Unbound or Dnsmasq) detected", which sends the operator looking at the DNS service instead of the API error.Related: #14 (the host-override readers swallow errors and return
[], which makessync_dns_zoneduplicate overrides). That fix covers the readers; this one is the detection in front of them, and the same[]reachesget_dns_entries.Expected
_detect_active_dnslets the request error propagate (or raises its ownConnectionExceptionwith the cause);Noneonly when the search succeeded and neither service runs. Test-first: a failingservice/searchmakesget_dns_entries()raise andsync_dns_zonereport the API error.Priority: P3 — DNS records disappear from netOrk after any transient API error, and the sync error names the wrong cause.
Found during the bug sweep of 2026-11-01.