fix(dal): raise on a failed request instead of reading it as empty
driver / standard (pull_request) Successful in 17s
driver / lint (pull_request) Successful in 15s
driver / types (pull_request) Successful in 1m10s
driver / test (3.12) (pull_request) Successful in 4m10s
driver / test (3.13) (pull_request) Successful in 4m6s
driver / lowest (pull_request) Successful in 3m43s
driver / build (pull_request) Successful in 31s
driver / security (pull_request) Successful in 1m17s
CI / driver (pull_request) Successful in 5m59s
driver / publish (pull_request) Skipped

_dal_query and _fetch_page returned None for any failure, and the
getters turned that into empty data, so a timeout or an expired session
read as a gateway with no hosts, port forwards, SSIDs or Wi-Fi clients.
Both now raise: ConnectionException when the gateway does not answer or
refuses the session, RuntimeError naming the request otherwise. A getter
whose DAL request fails still reads the HTML page and raises when that
fails too; get_facts no longer swallows a failed get_interfaces.

Closes #15
This commit is contained in:
Christian Manivong committed 2026-11-02 09:18:50 +01:00
1 parent da9e303e45
commit ded19238c0
4 files changed
+257 -94

No files matched your search

+9
View File
@@ -13,6 +13,15 @@ All notable changes to this driver. The format follows
3.12 venv no longer has.
### Fixed
- A failed request to the gateway raises instead of reading as empty data (#15). A
timeout, a refused session or an HTTP error made `get_hosts`, `get_arp_table`,
`get_port_forwards`, `get_nat_translations`, `get_wireless_clients`, `get_ssids`,
`get_radio_status` and `get_diagnostics` report a gateway with nothing configured.
They raise `ConnectionException` when the gateway does not answer or refuses the
session (HTTP 401/403) and `RuntimeError` naming the request otherwise. A getter
whose DAL request fails still reads the HTML page, and raises when that fails too.
`get_facts` no longer reports an empty interface list when the interfaces cannot be
read, and `reboot_host` / `restart_wifi` raise the same way when the request fails.
- `get_arp_table()` reports an unknown age as `-1.0` (napalm-device-types'
`ARP_AGE_UNKNOWN`) instead of `0.0`, which means "confirmed just now": the host
list says a host is active, not when the gateway last saw it (NetOrk/netork#1327).