mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-13 22:26:49 +00:00
checkmk crash-looped in swarm on run 33923190220, 82 convergence attempts, with PermissionError [Errno 13] on '/omd/sites/cmk/tmp/nagvis' raised from omdlib/tmpfs.py:294 while OMD populated the site's tmp skeleton. The mount is not the problem and must stay. Upstream's docker-entrypoint.sh runs `omd create --no-tmpfs` and the comment above it states the site tmp directory "might have been pre-created by docker when the --tmpfs option is used", so supplying that tmpfs externally is the intended pattern, not a workaround. The mode was the problem. container_volumes coerces a declared mode with int(text, 8), so "01777" reaches the stack file as the decimal 1023. Docker 29.7.2 reads that as raw mode bits and mounts 1777; the CI hosts run 28.0.4 and produced a directory the owning uid could not write. 0o1023 leaves the owner with no permission bits at all, which is exactly the failure. Docker's own default is already 1777, sticky and world-writable, which is what a site tmp needs, so the declaration could only ever match it or break it. Dropping the key restores the default. Measured on 29.7.2 in both `docker compose` and `docker stack deploy`: a mode-less tmpfs mounts 1777 and uid 1000, the uid `omd create -u 1000` gives the site, creates nagvis in it. The validator now rejects tmpfs 'mode' outright rather than checking it is octal. An octal check cannot help when the encoding itself does not survive to the container the same way on every engine version. merge/svc-net-tor still carries the old declaration and will fail this check if it lands.
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
- Module utilities: https://docs.ansible.com/ansible/latest/dev_guide/developing_module_utilities.html
- Plugin development: https://docs.ansible.com/ansible/latest/dev_guide/developing_plugins.html