diff --git a/backend/copr_backend/pulp.py b/backend/copr_backend/pulp.py index b9f47d866..162a8a63c 100644 --- a/backend/copr_backend/pulp.py +++ b/backend/copr_backend/pulp.py @@ -105,6 +105,12 @@ def get_distribution(self, name): url += self._urlencode({"name": name, "offset": 0, "limit": 1}) return requests.get(url, **self.request_params) + def get_task(self, task): + """ + Get a detailed information about a task + """ + url = self.config["base_url"] + task + return requests.get(url, **self.request_params) def _urlencode(self, query): """ Join a dict into URL query string but don't encode special characters diff --git a/backend/copr_backend/storage.py b/backend/copr_backend/storage.py index 998784d79..d5470f36c 100644 --- a/backend/copr_backend/storage.py +++ b/backend/copr_backend/storage.py @@ -189,7 +189,14 @@ def publish_repository(self, chroot, **kwargs): repository, response.text) return False - publication = response.json()["results"][0]["pulp_href"] + task = response.json()["task"] + response = self.client.get_task(task) + if not response.ok: + self.log.error("Failed to get Pulp task %s because of %s", + task, response.text) + return False + + publication = response.json()["created_resources"][0] distribution_name = self._distribution_name(chroot) distribution = self._get_distribution(chroot)