feat: sync execution with 3s progress polling (stage 2)

- pulp_client: get_repo / sync_repo / get_task (비동기 task href 반환)
- POST /repos/{uuid}/sync: remote 확인 후 동기화 시작, 진행률 조각 반환
- GET /repos/{uuid}/progress: progress_reports 합산 → 바/퍼센트,
  완료/실패 시 hx-trigger 제거로 폴링 중단
- task_store: uuid→task_href 메모리 추적 (단일 인스턴스), 대시보드 '동기화 중' 집계
- views.task_progress: state/done/total/percent + created_resources에서 새 vN
- 동기화는 안전 동작이라 확인 모달 없이 실행 (스펙 §5-1)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-17 11:09:37 +09:00
parent c1192ab09d
commit 6c41b89c53
14 changed files with 441 additions and 12 deletions

View File

@@ -48,7 +48,9 @@ class PulpClient:
resp.raise_for_status()
return resp.json()
def patch(self, href: str, json: Any | None = None, **kwargs: Any) -> dict[str, Any]:
def patch(
self, href: str, json: Any | None = None, **kwargs: Any
) -> dict[str, Any]:
resp = self._client.patch(href, json=json, **kwargs)
resp.raise_for_status()
return resp.json()
@@ -66,3 +68,23 @@ class PulpClient:
def get_version(self, version_href: str) -> dict[str, Any]:
"""RepositoryVersion 단건 조회 (href 기준). content_summary 등 포함."""
return self.get(version_href)
def get_repo(self, uuid: str) -> dict[str, Any]:
"""저장소 단건 조회 (remote href 등 확인용)."""
return self.get(f"{API_PREFIX}/repositories/rpm/rpm/{uuid}/")
def sync_repo(self, uuid: str, remote_href: str) -> str:
"""동기화 시작 → 비동기 task. 반환 task_href 를 폴링으로 추적한다(스펙 §4).
POST .../repositories/rpm/rpm/{uuid}/sync/ body {"remote": <remote_href>}
응답 {"task": "/pulp/api/v3/tasks/<uuid>/"} 에서 task href 추출.
"""
data = self.post(
f"{API_PREFIX}/repositories/rpm/rpm/{uuid}/sync/",
json={"remote": remote_href},
)
return data["task"]
def get_task(self, task_href: str) -> dict[str, Any]:
"""task 단건 조회 (state, progress_reports, created_resources, error)."""
return self.get(task_href)