1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-08 19:26:48 +00:00
webvirtcloud/appsettings
catborise e84db7542d fix(appsettings,vrtManager,storages): error handlers that hid the real failure
Reviewing the error handlers outside instances/ turned up three that masked or
swallowed the failure they caught:

- appsettings/settings.get_settings() runs on every request (middleware) and
  loads app_settings from the database. Its bare `except: pass` left `entries`
  unbound on a database error, so the next line raised UnboundLocalError
  instead; it also caught KeyboardInterrupt/SystemExit. It now catches
  DatabaseError and returns, keeping the already-loaded values.
- vrtManager.network.refresh_dhcp_leases raised a formatted string
  (`raise f"..."`), which Python rejects with TypeError, hiding the real
  DHCPLeases failure. It now raises util.OperationError, which the API/HTML
  error handling already renders as a libvirt error, and clears self.leases.
- storages.views.get_volumes caught libvirtError and answered 200 with an empty
  body, so the caller could not tell a failed pool read from an empty pool. It
  now returns 400 with the error.

The other broad handlers reviewed (appsettings/nwfilters/virtsecrets views,
storages/upload cleanup and recovery paths, vrtManager display getters) report
the error or are best-effort and were left as they are.

Tests: get_settings() survives a database error during the query and during
iteration without raising and still loads a real value; refresh_dhcp_leases
raises OperationError (keeping the cause) not TypeError; get_volumes returns 400
on a listing failure and the sorted volumes on success. The tests fail on the
previous code.
2026-10-07 11:29:45 +03:00
..
migrations fix(instances): a clone stays on the host of the VM it was made from 2026-10-06 15:58:35 +03:00
templates Bootstrap5 (#17) 2021-07-07 14:12:38 +03:00
__init__.py Add Settings page: Move theme & lang changer to settings page 2020-06-04 12:03:26 +03:00
apps.py fix: track migrations; installs apply them instead of generating them 2026-10-04 01:08:11 +03:00
context_processors.py Some improvements for appsettings app 2020-06-17 15:15:58 +06:00
middleware.py ci: replace super-linter with ruff 2026-10-04 01:08:11 +03:00
models.py format python code with black 2022-11-02 08:54:35 +03:00
settings.py fix(appsettings,vrtManager,storages): error handlers that hid the real failure 2026-10-07 11:29:45 +03:00
test_appsettings.py fix(instances): a clone stays on the host of the VM it was made from 2026-10-06 15:58:35 +03:00
test_get_settings.py fix(appsettings,vrtManager,storages): error handlers that hid the real failure 2026-10-07 11:29:45 +03:00
test_theme_name.py fix(appsettings): SASS_DIR must be a directory inside the project 2026-10-06 08:48:51 +03:00
tests.py ci: replace super-linter with ruff 2026-10-04 01:08:11 +03:00
views.py fix(appsettings): SASS_DIR must be a directory inside the project 2026-10-06 08:48:51 +03:00