Files
Spoolman/spoolman
Aleksei Sviridkin f7da164599 fix(externaldb): report the unwritable path instead of raising NameError (#964)
The fallback to an in-memory cache never worked when the data directory
itself is not writable. Evaluating cache_path calls get_cache_dir(), which
creates the data directory, so a PermissionError raised there propagates out
before cache_path is ever bound. The handler then dereferences it and dies
with "NameError: name 'cache_path' is not defined", which both hides the real
cause and takes the application down at import time, before the startup code
that would have reported the permission problem in plain language runs.

Take the path from the exception instead. It is set for both cases: the data
directory that could not be created, and the cache directory underneath it.

Verified against the published image by running it as a UID that owns neither
directory, which is what a restricted Kubernetes SecurityContext does:

  docker run --rm --user 1000670000:0 ghcr.io/donkie/spoolman:0.24.0

Before, that failed with the NameError above. Now it logs "Ensure the path
/.local is writable" and carries on to the regular startup check.

Assisted-By: Claude <noreply@anthropic.com>

Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-07-21 21:50:06 +02:00
..
2023-04-02 19:19:15 +02:00
2026-07-07 10:12:35 +02:00
2024-05-23 19:42:27 +02:00
2026-01-19 20:47:06 +01:00
2024-05-23 19:42:27 +02:00