Agent: bash script run hourly by a hardened systemd timer on Debian 12/13 and Ubuntu 24.04. Collects running vs installed kernel (needrestart when available), pending/security updates via a read-only apt simulation, reboot-required state and apt list freshness, and POSTs them as JSON. Server: stdlib-only Python + SQLite (system python3 >= 3.11). Token-bound ingest API, login-protected dashboard with per-host status (stale/reboot/update/ok) and history, admin CLI, systemd unit and installer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
702 B
Python
26 lines
702 B
Python
"""Shared test setup: put server/ on sys.path and build throwaway configs."""
|
|
|
|
import os
|
|
import sys
|
|
import tempfile
|
|
|
|
REPO = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
sys.path.insert(0, os.path.join(REPO, "server"))
|
|
|
|
from kernelwatch.config import Config # noqa: E402
|
|
|
|
|
|
def temp_config(tmp: str, **overrides) -> Config:
|
|
return Config(db_path=os.path.join(tmp, "kw.db"), listen_port=0, secure_cookies=False,
|
|
**overrides)
|
|
|
|
|
|
def tempdir() -> tempfile.TemporaryDirectory:
|
|
return tempfile.TemporaryDirectory(prefix="kw-test-")
|
|
|
|
|
|
# Keep request logs out of test output.
|
|
from kernelwatch import web # noqa: E402
|
|
|
|
web.Handler.log_message = lambda self, *args: None
|