mirror of
https://github.com/Donkie/Spoolman.git
synced 2026-10-22 01:52:17 -05:00
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>