Skip to content

pyobsd: mode switch, PID-file backend, guard against --pid-file in systemd mode - #1105

Merged
thusser merged 1 commit into
developfrom
feat/pyobsd-mode
Nov 25, 2026
Merged

thusser merged 1 commit into
developfrom
feat/pyobsd-mode

Conversation

@thusser

@thusser thusser commented Nov 25, 2026

Copy link
Copy Markdown
Member

First step of the pyobsd systemd mode (specs/plans/2026-11-25-pyobsd-systemd-mode.md). There's no systemd backend yet.

Changes

  • Mode switch: pyobsd.mode in the config file, --mode and $PYOBSD_MODE (pid or systemd, default pid). pyobsd_mode() in pyobs/cli/_cli.py does the lookup for both CLIs: the environment first, then the config file. CLI.file_config now holds the whole config file, so pyobs can read the pyobsd section. In systemd mode, pyobsd exits with "not implemented yet".
  • Backend split: the PID-file code moves unchanged into PidFileDaemon. The parts both modes share (names, configs, process info, list, logs) go into the abstract PyobsDaemonBase. PyobsDaemon stays as an alias, so the existing tests run unchanged.
  • Guard: pyobs --pid-file refuses to start when the config says systemd, unless PYOBSD_MODE=pid is set. pyobsd in PID-file mode now always passes PYOBSD_MODE=pid to the modules it starts, so pyobsd --mode pid also works on a systemd host. This is the one behavior change in the PID-file backend: Popen now always gets an env.

Tests

  • New tests in tests/cli/test_mode.py: the lookup, file_config, the guard, --mode, and the env passed to the modules.
  • The tests in tests/cli/test_pyobsd_pidmode.py and test_pyobsd.py pass unchanged.
  • Full suite without integration/xmpp: 2799 passed.
  • ruff, black and pyrefly are clean.

🤖 Generated with Claude Code

…file

- pyobsd.mode in the config file, --mode and $PYOBSD_MODE (pid or systemd,
  default pid), with one lookup (pyobsd_mode) shared by pyobs and pyobsd.
  systemd mode exits with "not implemented yet" for now.
- The PID-file code moves unchanged into PidFileDaemon, shared parts into
  PyobsDaemonBase. PyobsDaemon stays as an alias.
- pyobs refuses --pid-file in systemd mode unless PYOBSD_MODE=pid, which
  pyobsd in PID-file mode sets for the modules it starts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thusser
thusser merged commit 65dbb51 into develop Nov 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant