Files
computer-playbook/cli/deploy/dedicated/paths.py
T
kevinveenbirkenbach 103659a534 refactor(deploy): modularize dedicated deploy CLI and fix make cwd issue
- Split dedicated deploy logic into focused modules (apps, modes, paths, proc, runner)
- Ensure all make targets run from the repository root via explicit cwd handling
- Fix "make: No rule to make target" errors caused by incorrect working directory
- Slim down __main__ to a thin CLI entrypoint
- Rework unit tests into one file per module and expand coverage

https://chatgpt.com/share/69472632-9740-800f-962c-bcb4474963d6
2025-12-20 23:41:41 +01:00

27 lines
856 B
Python

from __future__ import annotations
import os
def _resolve_repo_root() -> str:
"""
Resolve repository root based on this file location.
Current file: <repo>/cli/deploy/dedicated/paths.py
"""
here = os.path.realpath(__file__)
dedicated_dir = os.path.dirname(here) # .../cli/deploy/dedicated
deploy_dir = os.path.dirname(dedicated_dir) # .../cli/deploy
cli_root = os.path.dirname(deploy_dir) # .../cli
repo_root = os.path.dirname(cli_root) # .../<repo-root>
return repo_root
REPO_ROOT: str = _resolve_repo_root()
CLI_ROOT: str = os.path.join(REPO_ROOT, "cli")
PLAYBOOK_PATH: str = os.path.join(REPO_ROOT, "playbook.yml")
MODES_FILE: str = os.path.join(REPO_ROOT, "group_vars", "all", "01_modes.yml")
INVENTORY_VALIDATOR_PATH: str = os.path.join(
REPO_ROOT, "cli", "validate", "inventory", "__main__.py"
)