Files
getDomain/domain-api/app/services/ops_command_service.py
2026-04-18 23:52:51 +08:00

18 lines
597 B
Python

from __future__ import annotations
OPS_MULTI_REGION_DIR = "domain-api/deploy/multi-region"
def ops_script_path(script_name: str) -> str:
normalized_script_name = str(script_name or "").strip().lstrip("/")
if not normalized_script_name:
return OPS_MULTI_REGION_DIR
return f"{OPS_MULTI_REGION_DIR}/{normalized_script_name}"
def build_bash_command(script_name: str, *args: object) -> str:
command_parts = ["bash", ops_script_path(script_name)]
command_parts.extend(str(arg or "").strip() for arg in args if str(arg or "").strip())
return " ".join(command_parts)