mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-08 11:46:35 +00:00
- compose/noports.override.yml drops every published port via !override - compose_file_args appends it when INFINITO_PUBLISH_PORTS=false - runner instances set the flag; default true keeps other flows unchanged - central yaml loader + ansible-lint config accept compose merge tags Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
VALID_DISTROS: tuple[str, ...] = ("arch", "debian", "ubuntu", "fedora", "centos")
|
|
|
|
|
|
def compose_file_args() -> list[str]:
|
|
"""Compose `-f` flags shared by up and down flows."""
|
|
from .profile import Profile
|
|
|
|
out = ["-f", "compose.yml"]
|
|
if Profile().registry_cache_active():
|
|
out += ["-f", "compose/cache.override.yml"]
|
|
if (os.environ.get("INFINITO_PUBLISH_PORTS") or "").strip().lower() == "false":
|
|
out += ["-f", "compose/noports.override.yml"]
|
|
return out
|
|
|
|
|
|
def resolve_distro() -> str:
|
|
"""Return INFINITO_DISTRO; raise SystemExit if missing or invalid."""
|
|
distro = os.environ["INFINITO_DISTRO"].strip()
|
|
if not distro:
|
|
raise SystemExit(
|
|
"INFINITO_DISTRO is not set. Run 'make dotenv' (or source scripts/meta/env/load.sh) "
|
|
"or export INFINITO_DISTRO=<arch|debian|ubuntu|fedora|centos> "
|
|
"before invoking cli.administration.deploy.development."
|
|
)
|
|
if distro not in VALID_DISTROS:
|
|
raise SystemExit(
|
|
f"INFINITO_DISTRO={distro!r} is not a valid distro. "
|
|
f"Valid: {', '.join(VALID_DISTROS)}."
|
|
)
|
|
return distro
|