mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-27 13:28:01 +00:00
Work-in-progress commit on the collective code-scanning sidetree, so main can be merged in; the single quality-high gate runs on the integration branch before the pull request. Fixes the CodeQL notes py/import-and-import-from, py/unused-import, py/unused-global-variable, py/empty-except, py/mixed-tuple-returns and py/unused-local-variable across 194 files, and adds one lint per rule under tests/lint/repository/python/ so none of them can come back: test_import_and_import_from, test_unused_imports_hidden_from_ruff, test_unused_global_variables, test_empty_except, test_mixed_tuple_returns, test_unused_local_variables, plus test_modules_import. Accepted security finding: MEDUSA-MP-SCAN-2056 (low) on utils/i18n/client.py:21, an import line matched by a keyword heuristic; operator-confirmed false positive. 🎯 Fix: 85 % 💥 Break: 8 % 💸 Cost: – ⏱️ Time: – 🛡️ Security: 100 % 🏆 Score: 78 🚦 Gate: ⛔ fix 85 % < 90, break 8 % > 5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
"""Shared helpers for the development deploy CLI.
|
|
|
|
``DEV_INVENTORY_VARS_FILE`` mirrors ``INFINITO_INVENTORY_VARS_FILE``
|
|
from ``default.env``; the pairing is drift-guarded.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
from typing import TYPE_CHECKING
|
|
|
|
from utils.cache import PROJECT_ROOT
|
|
|
|
from .env import resolve_distro
|
|
|
|
if TYPE_CHECKING:
|
|
from .compose import Compose
|
|
|
|
|
|
DEV_INVENTORY_VARS_FILE: str = (
|
|
os.environ.get("INFINITO_INVENTORY_VARS_FILE")
|
|
or "inventories/development/default.yml"
|
|
)
|
|
|
|
|
|
def resolve_container() -> str:
|
|
"""Return INFINITO_CONTAINER; raise SystemExit if unset."""
|
|
container = os.environ["INFINITO_CONTAINER"].strip()
|
|
if not container:
|
|
raise SystemExit(
|
|
"INFINITO_CONTAINER is not set. Run 'make dotenv' (or source scripts/meta/env/load.sh) "
|
|
"before invoking cli.administration.deploy.development."
|
|
)
|
|
return container
|
|
|
|
|
|
def make_compose() -> Compose:
|
|
from .compose import Compose
|
|
|
|
distro = resolve_distro()
|
|
resolve_container()
|
|
return Compose(repo_root=PROJECT_ROOT, distro=distro)
|