fix(radius): the getters raise when the firewall does not answer (#49) #50

Merged
christianmanivong merged 1 commits from fix/radius-read-errors into main 2026-11-15 19:24:02 +00:00
Owner

get_radius_clients() and get_radius_users() caught every exception and returned [], so a caller could not tell "no entries" from "no answer".

netOrk asks these getters whether a RADIUS entry whose add was cut off is still on the firewall (NetOrk/netork#2162, PR NetOrk/netork#2546). On an empty list it would forget a NAS client that is still live there, with its shared secret.

What changes

  • Both getters now raise when the request fails or the answer holds no rows list (_search_rows). An empty list now means FreeRADIUS has none.
  • RADIUS_READS_RAISE = True on the driver class declares this. netOrk (PR NetOrk/netork#2546) trusts an empty list only from a driver that says so.
  • create_radius_client() and create_radius_user() still answer success after a saved add whose id lookup fails. The add went through, and the id stays None, as before when the name was not found.

Callers

No other caller of the two getters exists in the driver or in netOrk except netOrk's RADIUS runs on PR NetOrk/netork#2546: the delete by name and the settling of a pending entry. Both treat a raise as "could not tell", keep the row, and ask again later.

Tests

  • First the new tests, which failed: a failed request and an answer without rows raise; an empty rows list is []; the driver declares RADIUS_READS_RAISE; a saved add whose lookup fails is still a success.
  • Then the fix. The driver's whole suite: 626 passed. Ruff and mypy are clean.

Closes #49

`get_radius_clients()` and `get_radius_users()` caught every exception and returned `[]`, so a caller could not tell "no entries" from "no answer". netOrk asks these getters whether a RADIUS entry whose add was cut off is still on the firewall (NetOrk/netork#2162, PR NetOrk/netork#2546). On an empty list it would forget a NAS client that is still live there, with its shared secret. ## What changes - Both getters now **raise** when the request fails or the answer holds no `rows` list (`_search_rows`). An empty list now means FreeRADIUS has none. - `RADIUS_READS_RAISE = True` on the driver class declares this. netOrk (PR NetOrk/netork#2546) trusts an empty list only from a driver that says so. - `create_radius_client()` and `create_radius_user()` still answer `success` after a saved add whose id lookup fails. The add went through, and the id stays `None`, as before when the name was not found. ## Callers No other caller of the two getters exists in the driver or in netOrk except netOrk's RADIUS runs on PR NetOrk/netork#2546: the delete by name and the settling of a pending entry. Both treat a raise as "could not tell", keep the row, and ask again later. ## Tests - First the new tests, which failed: a failed request and an answer without `rows` raise; an empty `rows` list is `[]`; the driver declares `RADIUS_READS_RAISE`; a saved add whose lookup fails is still a success. - Then the fix. The driver's whole suite: 626 passed. Ruff and mypy are clean. Closes #49
christianmanivong added 1 commit 2026-11-15 18:02:22 +00:00
fix(radius): the getters raise when the firewall does not answer (#49)
driver / standard (pull_request) Failing after 17s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 1m0s
driver / test (3.13) (pull_request) Successful in 1m0s
driver / test (3.12) (pull_request) Successful in 1m12s
driver / lowest (pull_request) Successful in 32s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 1m3s
CI / driver (pull_request) Failing after 2m21s
driver / publish (pull_request) Skipped
9c31afd5d7
get_radius_clients() and get_radius_users() caught every exception and
returned [], so a caller could not tell no entries from no answer. netOrk
asks them whether an entry whose add was cut off is on the firewall, and an
empty list would have made it forget a NAS client still live there. Both now
raise for a failed request or an answer without rows; an empty list is the
firewall's answer, which RADIUS_READS_RAISE = True declares. A saved add
whose id lookup fails still answers success, with no id.

Closes #49
christianmanivong merged commit 6c1aaf1690 into main 2026-11-15 19:24:02 +00:00
christianmanivong deleted branch fix/radius-read-errors 2026-11-15 19:24:02 +00:00
Sign in to join this conversation.