Files
alzeo/tests/test_cockpit_unit_paths.py
T
Hasan BasbunarandClaude Opus 5.5 ad9466aede cockpit: a refused key is not a logout, forensics that are stacks, binds it can serve
The System One route relayed the proxy's 401 as it was, and the page reads a 401 as its
own session ending: a key the proxy refuses is a 502 with the proxy's status now. The
py-spy wrapper printed its errors on stdout and the cockpit saved any text back as the
scheduler's stacks; errors go to stderr and the exit status decides. DASH_BIND=:: made the
unit fail at every start (both servers speak IPv4): IPv4 binds only, strictly checked. A
missing config folder failed the unit at its namespace step: its ReadWritePaths entry is
optional. The py-spy sudoers line allowed any arguments: it allows none.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 19:20:27 +02:00

27 lines
1.1 KiB
Python

#!/usr/bin/env python3
"""The cockpit unit starts whether or not its config folder exists yet.
ReadWritePaths= names paths systemd binds into the unit's mount namespace, and a path that
is not there fails the start at that step (226/NAMESPACE) unless it is marked optional
with "-": a cockpit installed on its own, or a removed config folder, never started
(found in review, 2026-09-24). /etc/systemd/system always exists, and the Switch button
needs it bound, so it stays mandatory."""
import pathlib
import unittest
REPO = pathlib.Path(__file__).resolve().parents[1]
UNIT = (REPO / "dashboard" / "qwen38-dashboard.service.template").read_text()
class ThePaths(unittest.TestCase):
def test_the_config_folder_is_optional(self):
rw = [ln.split("=", 1)[1] for ln in UNIT.splitlines() if ln.startswith("ReadWritePaths=")]
self.assertIn("-__HOME__/.config/qwen38", rw)
self.assertIn("/etc/systemd/system", rw)
home = [p for p in rw if "__HOME__" in p]
self.assertTrue(all(p.startswith("-") for p in home), home)
if __name__ == "__main__":
unittest.main(verbosity=2)