Files
computer-playbook/utils
kevinveenbirkenbach 24b4a6beba fix(swarm-test): venv on PATH + restate static swarm.yml keys in extras
Two distinct breakages that let the workflow fail before ever reaching
the ansible deploy:

* `python3 -m utils.tests.swarm.*` (and friends) ran with the
  actions-setup interpreter that has no project deps, so the imports
  of `plugins.filter.canonical_domains_map` blew up on `from ansible.errors`.
  The swarm preamble scripts now source `scripts/meta/env/load.sh` so
  PATH picks up the venv `make install` populated, and the workflow itself
  uses `install-force` (under `act --bind` the build/install.stamp is the
  host's and would short-circuit the in-container install) plus pushes
  `\${VENV}/bin` onto GITHUB_PATH for downstream steps.

* `ansible-playbook -e @file` replaces top-level dicts rather than
  deep-merging them. The runtime-only extras file was dropping
  `storage.nfs.{export_base,version}`, `storage.backend`, and
  `swarm.{registry.port,network}` that the static
  `inventories/development/swarm.yml` ships. Re-state those keys
  in write_extras.py so the merge ends up with everything the roles need.
2026-06-05 09:52:59 +02:00
..

Shared Utilities (utils/)

This directory contains shared Python helpers used by custom modules and plugins.

Purpose

Use utils/ for reusable code that should not be duplicated across:

  • library/ modules,
  • plugins/action/,
  • plugins/filter/,
  • plugins/lookup/.

Typical shared utilities:

  • API clients,
  • validation/conversion helpers,
  • path and configuration helpers,
  • cross-plugin/module domain logic.
  • Shared HTTP(S) connection handler for multiple modules.
  • Common validation or transformation functions for user input.
  • Utility functions for interacting with Docker, LDAP, etc.
  • Grouped helper packages such as utils/domains/ for related domain logic.

Design Guidelines

  • Keep helpers focused and composable.
  • Avoid side effects during import.
  • Prefer explicit function/class APIs over implicit globals.
  • Keep dependencies minimal so modules/plugins stay lightweight.

Example Import

from utils.domains.primary_domain import get_primary_domain

What Does Not Belong Here

  • Standalone executable modules (put in library/).
  • Ansible plugin entrypoints (put in plugins/*).

References