fix: traefik YAML filename uses {code}-test.yml for trial/test environment

正式: {code}.yml, 測試: {code}-test.yml,與容器命名一致

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
VMIS Developer
2026-03-16 01:38:02 +08:00
parent d60b62cbbc
commit 1ee0e98243

View File

@@ -288,7 +288,8 @@ def _ensure_traefik_routes(tenant, is_active: bool) -> bool:
try:
import paramiko
code = tenant.code
file_path = f"{TRAEFIK_DYNAMIC_DIR}/{code}.yml"
yaml_name = f"{code}.yml" if is_active else f"{code}-test.yml"
file_path = f"{TRAEFIK_DYNAMIC_DIR}/{yaml_name}"
expected = _generate_tenant_route_yaml(tenant, is_active)
client = paramiko.SSHClient()
@@ -302,14 +303,14 @@ def _ensure_traefik_routes(tenant, is_active: bool) -> bool:
existing = f.read().decode()
if existing == expected:
needs_write = False
logger.info(f"Traefik route {code}.yml: already correct")
logger.info(f"Traefik route {yaml_name}: already correct")
except FileNotFoundError:
logger.info(f"Traefik route {code}.yml: not found, creating")
logger.info(f"Traefik route {yaml_name}: not found, creating")
if needs_write:
with sftp.open(file_path, "w") as f:
f.write(expected)
logger.info(f"Traefik route {code}.yml: written")
logger.info(f"Traefik route {yaml_name}: written")
sftp.close()
client.close()