mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-07 03:15:56 +00:00
- 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
30 lines
850 B
Python
30 lines
850 B
Python
from __future__ import annotations
|
|
|
|
import sys
|
|
from typing import List
|
|
|
|
|
|
def validate_application_ids(inventory: str, app_ids: List[str]) -> None:
|
|
"""Validate requested application IDs using ValidDeployId."""
|
|
if not app_ids:
|
|
return
|
|
|
|
from module_utils.valid_deploy_id import ValidDeployId
|
|
|
|
validator = ValidDeployId()
|
|
invalid = validator.validate(inventory, app_ids)
|
|
|
|
if not invalid:
|
|
return
|
|
|
|
print("\n[ERROR] Some application_ids are invalid for this inventory:\n")
|
|
for app_id, status in invalid.items():
|
|
reasons = []
|
|
if not status.get("allowed", True):
|
|
reasons.append("not allowed by configuration")
|
|
if not status.get("in_inventory", True):
|
|
reasons.append("not present in inventory")
|
|
print(f" - {app_id}: {', '.join(reasons)}")
|
|
|
|
sys.exit(1)
|