Files
computer-playbook/cli/deploy/test/deps.py
T
kevinveenbirkenbach 1ca0fd05b0 fix(deploy-test): capture run_after resolver output for dependency resolution
Ensure stdout is captured when calling run_after_resolution inside the infinito
container so declared galaxy_info.run_after deps (e.g. matomo, mailu) are
correctly detected and added to deploy_ids.

https://chatgpt.com/share/69617fbb-5af4-800f-848d-edeb2c1125a8
2026-01-09 23:22:41 +01:00

39 lines
1.2 KiB
Python

from __future__ import annotations
from .compose import Compose
def resolve_run_after(compose: Compose, role_name: str) -> list[str]:
"""
Calls resolver inside the infinito container:
python -m cli.meta.applications.run_after_resolution <role_name>
"""
cmd = ["python3", "-m", "cli.meta.applications.run_after_resolution", role_name]
r = compose.exec(cmd, check=False, workdir="/opt/src/infinito", capture=True)
if r.returncode != 0:
raise RuntimeError(
f"run_after_resolution failed for {role_name} (rc={r.returncode})\n"
f"STDOUT:\n{r.stdout}\nSTDERR:\n{r.stderr}"
)
txt = (r.stdout or "").strip()
if not txt:
return []
return [t for t in txt.split() if t.strip()]
def apps_with_deps(app_id: str, deps_role_names: list[str]) -> list[str]:
"""
The resolver returns role folder names. In your current inventory groups,
group names == application_ids (folder names). So we can include them directly.
"""
# ensure prerequisites first + app_id last
out: list[str] = []
for d in deps_role_names:
if d != app_id and d not in out:
out.append(d)
if app_id not in out:
out.append(app_id)
return out