fix(rest): raise on a failed REST read instead of returning {}
driver / standard (pull_request) Successful in 17s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Successful in 1m14s
driver / test (3.12) (pull_request) Successful in 1m9s
driver / test (3.13) (pull_request) Successful in 1m10s
driver / lowest (pull_request) Successful in 30s
driver / build (pull_request) Successful in 33s
driver / security (pull_request) Successful in 1m10s
CI / driver (pull_request) Successful in 2m49s
driver / publish (pull_request) Skipped

ProcurveApiClient.get() answered {} for a timeout, a refused session or
any HTTP error, so every REST getter reported a failed read as a switch
with no hostname, ports, VLANs or neighbours. get() now raises
ConnectionException (no answer, 401/403) or RuntimeError (other
non-2xx, a body that is not JSON); the getters that expect a resource
to be missing on some firmware pass missing_ok for its 404.

get_config no longer returns an empty configuration when both the REST
read and the SSH fallback failed, and cli() over REST raises instead of
returning "Error: HTTP <status>" as the command's output.

Closes #22
This commit is contained in:
Christian Manivong committed 2026-11-02 08:39:04 +01:00
1 parent 1105c47a3d
commit 628a827cbe
6 files changed
+340 -73

No files matched your search

+13
View File
@@ -49,6 +49,19 @@ All notable changes to this driver. The format follows
- `get_snmp_config` reads the switch's communities over the REST API too. It returned
`None` there, so a switch managed over REST always read as having no SNMP. A read that
fails now raises instead of reading as "no SNMP" (REST transport).
- A failed read over the REST API raises instead of reading as an empty switch (#22).
A timeout, a refused session or an HTTP error made `get_facts`, `get_interfaces`,
`get_interfaces_ip`, `get_vlans`, `get_arp_table`, `get_mac_address_table`,
`get_lldp_neighbors(_detail)`, `get_ntp_servers` and `get_poe_status` answer with no
hostname, ports, VLANs or neighbours. They now raise `ConnectionException` when the
switch does not answer or refuses the session (HTTP 401/403) and `RuntimeError` for
any other HTTP error. A resource that some firmware or configurations do not have
(HTTP 404) is left out as before: the DNS domain, port speeds, a VLAN's IPv4 address,
PoE on a switch without it.
- `get_config` raises when neither the REST API nor the SSH fallback could read the
configuration. It returned an empty running configuration.
- `cli()` over the REST API raises when the request fails. It returned
`"Error: HTTP <status>"` as if that were the command's output.
## [0.6.0] - 2026-10-23