Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upSkip the publish and create directly the publication. #334
Conversation
f1a2a44
to
ce0cc34
|
@pulp/qe please also review pulp/pulp-smash#1194 |
| @@ -77,21 +68,13 @@ def test_all(self): | |||
| non_latest = choice(version_hrefs[:-1]) | |||
|
|
|||
| # Step 2 | |||
| publication = publish(self.cfg, publisher, repo) | |||
| publication1 = publication(self.cfg, DOCKER_PUBLICATION_PATH, repo) | |||
rochacbruno
Apr 2, 2019
Member
Pulp-Smash now has a task_handler it was added recently in pulp/pulp-smash#1184
Now you don't need that extra publication function and can simply do
publication1 = self.client.using_handler(api.task_handler).post(
DOCKER_PUBLICATION_PATH,
data={"repository": repo["_href"]}
)
The above post response will be passed to api.task_handler which will do exactly what your publication function is doing see: https://github.com/PulpQE/pulp-smash/blob/master/pulp_smash/api.py#L205-L268
Pulp-Smash now has a task_handler it was added recently in pulp/pulp-smash#1184
Now you don't need that extra publication function and can simply do
publication1 = self.client.using_handler(api.task_handler).post(
DOCKER_PUBLICATION_PATH,
data={"repository": repo["_href"]}
)The above post response will be passed to api.task_handler which will do exactly what your publication function is doing see: https://github.com/PulpQE/pulp-smash/blob/master/pulp_smash/api.py#L205-L268
|
@rochacbruno i updated the code and closed the opened PR, task_handler covers the usecase we need. |
| kwargs={ | ||
| 'publisher_pk': str(publisher.pk), | ||
| 'repository_version_pk': str(repository_version.pk) |
asmacdo
Apr 3, 2019
Contributor
super duper nit: with the other line gone, it would be nice to put all the kwargs on a single line.
super duper nit: with the other line gone, it would be nice to put all the kwargs on a single line.
| @@ -148,42 +149,40 @@ def sync(self, request, pk): | |||
| return OperationPostponedResponse(result, request) | |||
|
|
|||
|
|
|||
| class DockerPublisherViewSet(PublisherViewSet): | |||
| class DockerPublicationViewSet(NamedModelViewSet, mixins.CreateModelMixin): | |||
asmacdo
Apr 3, 2019
Contributor
I think this should probably also have these mixins: [list, read, delete]
I think this should probably also have these mixins: [list, read, delete]
ipanova
Apr 3, 2019
Author
Member
just create, this is a custom endpoint
just create, this is a custom endpoint
| endpoint_name = 'docker' | ||
| queryset = models.DockerPublisher.objects.all() | ||
| serializer_class = serializers.DockerPublisherSerializer | ||
| endpoint_name = 'docker/publications' |
asmacdo
Apr 3, 2019
Contributor
I think this endpoint should be publications/docker. This is closer to the truth, the object is created is a publication, and the returned value of a /v3/publication will be less surprising.
Its worth noting that all the master/detail endpoints are structured in this way, ie content/docker remotes/docker
I think this endpoint should be publications/docker. This is closer to the truth, the object is created is a publication, and the returned value of a /v3/publication will be less surprising.
Its worth noting that all the master/detail endpoints are structured in this way, ie content/docker remotes/docker
a345360
to
6fcbffd
|
I just noticed one potential surprise. I think this endpoint can publish any repository version, not just docker ones. Hopefully people won't do that? However we go, this is an improvement, +1 to merge |
| Use the ``bar`` Publisher to create a Publication | ||
| Create a Publication |
asmacdo
Apr 4, 2019
Contributor
Given the new endpoint name, I think we should call this "publish a repository version"
Given the new endpoint name, I think we should call this "publish a repository version"

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

closes #4378
https://pulp.plan.io/issues/4378