Files
computer-playbook/utils
kevinveenbirkenbachandClaude Opus 5 5790359cd0 fix(i18n): keep a rejection sample from breaking the catalog it annotates
record() quotes the rejected translation into a PO comment and guarded the known hazard, a trailing backslash, with rstrip. The guard sits too early: babel wraps the finished comment across several # lines afterwards, so a backslash inside the string can land at a break it never saw. In docs/tr the wrap fell inside an escaped \\\\ of the source, gettext read the dangling backslash as a line continuation, swallowed the msgid below it, and msgfmt reported 56451:7 syntax error on an msgstr with no counterpart. docs/zh failed the same way.

Removing every backslash instead of the last one makes the hazard impossible wherever the wrap falls, and a newline becomes a space rather than an escape that reintroduces one. A rejection sample quotes what the engine said; it needs no escapes.

Reproduced and closed: both catalogs failed msgfmt before and pass after. A sweep over the tree finds no syntax error in any of the 180+ catalogs, though 24 still carry the same dangling backslash where the next line happens to be another comment.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-10-05 02:43:35 +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