fix: skip NC/OO/quota steps for manager tenant in scheduler

Manager tenant (is_manager=True) only needs Traefik route + SSO + Mailbox.
NC and OO containers should not be created for the manager tenant.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
VMIS Developer
2026-03-15 19:32:12 +08:00
parent 92ee91019e
commit 5d4e8087fb

View File

@@ -929,6 +929,13 @@ def run_tenant_check(schedule_log_id: int, db: Session):
# ── [4] NC container + DB 驗證 + OIDC 設定 ───────────────────────── # ── [4] NC container + DB 驗證 + OIDC 設定 ─────────────────────────
pg_db = f"nc_{tenant.code}_db" pg_db = f"nc_{tenant.code}_db"
if tenant.is_manager:
# Manager 租戶無需 NC/OO 容器,直接標記成功
result.nc_result = True
result.nc_done_at = now_tw()
result.office_result = True
result.office_done_at = now_tw()
else:
try: try:
nc_state = docker.check_container_ssh(nc_name) nc_state = docker.check_container_ssh(nc_name)
if nc_state is None: if nc_state is None:
@@ -1002,6 +1009,7 @@ def run_tenant_check(schedule_log_id: int, db: Session):
fail_reasons.append(f"oo: {e}") fail_reasons.append(f"oo: {e}")
# ── [6] Quota (OO disk + PG DB size) ──────────────────────────────── # ── [6] Quota (OO disk + PG DB size) ────────────────────────────────
if not tenant.is_manager:
try: try:
oo_gb = docker.get_oo_disk_usage_gb(oo_name) or 0.0 oo_gb = docker.get_oo_disk_usage_gb(oo_name) or 0.0
pg_gb = _get_pg_db_size_gb(pg_host, pg_db, pg_port) or 0.0 pg_gb = _get_pg_db_size_gb(pg_host, pg_db, pg_port) or 0.0