[Pulp-list] how to get the rpm publication HREF

Tatiana Tereshchenko ttereshc at redhat.com
Mon May 27 12:11:33 UTC 2019


Here is the PR to update the docs:
https://github.com/pulp/pulp_rpm/pull/1357

Tanya

On Mon, May 27, 2019 at 1:04 PM Tatiana Tereshchenko <ttereshc at redhat.com>
wrote:

> Hi Juan,
>
> One option is to filter by a repo like this:
> export PUBLICATION_HREF=$(http :24817/pulp/api/v3/publications/rpm/rpm/ |
> jq -r '.results[] | select(.repository_version|test("'$REPO_HREF'.")) |
> ._href')
>
> I'll update the docs, thank you for the catch!
>
>
> Also, to get the href at the creation of the publication will help and
>> reduce the number of task.
>>
> You get only a task href at the time of API call that creates a
> publication because this call is asynchronous, so it's not possible to
> return href of a publication right away.
> You can query the task and whenever it's complete you can get a
> publication href, e.g.
> export PUBLICATION_HREF=$(http
> :24817/pulp/api/v3/tasks/2c83e17f-f036-44f8-a753-e5e78a79984b/ | jq -r
> '.created_resources[]' | grep publications)
>
> grep part is not necessary here since no other resources are getting
> created with that call but for other calls there can be multiple resources
> created within one task.
>
> Hope that helps,
> Tanya
>
> On Sat, May 25, 2019 at 12:47 AM Juan Cabrera <juan.cabrera at unamur.be>
> wrote:
>
>> Hi,
>>
>> I have problems getting the HREF of a rpm publication to create the
>> distribution.
>>
>> in
>> https://pulp-rpm.readthedocs.io/en/latest/workflows/create_sync_publish.html#create-a-publication
>>
>> the command
>>
>> $ http POST :24817/pulp/api/v3/publications/rpm/rpm/ repository=$REPO_HREF
>>
>> Do not return the _href as in the example. It only gives the task, so I
>> can not get the HREF at this moment.
>>
>> The next command
>>
>> $ export PUBLICATION_HREF=$(http :24817/pulp/api/v3/publications/rpm/rpm/
>> | jq -r '.results[] | ._href')
>>
>> only works when there is only one publication. When there is more than
>> one it gives
>>
>> [vagrant at dev-pulp-server ~]$ http
>> $PORT/pulp/api/v3/publications/rpm/rpm/  | jq -r '.results[] | ._href'
>> /pulp/api/v3/publications/rpm/rpm/2e145f16-95a8-4a35-b1e4-ecdb5c4c08d9/
>> /pulp/api/v3/publications/rpm/rpm/fa835dfb-4c33-4d7c-a74b-b0065b43ca97/
>> /pulp/api/v3/publications/rpm/rpm/d4cd0d2a-9979-43af-8bcb-e4d24f8f6ebd/
>> /pulp/api/v3/publications/rpm/rpm/c81bf7e3-8ba4-4642-a64f-fae6a73bc9ed/
>>
>> In previous release the selection was done with the publisher href
>>
>> $ export PUBLICATION_HREF=$(http :24817/pulp/api/v3/publications/rpm/rpm/
>> | jq -r '.results[] | ._href')
>>
>> It will be interesting to have a query parameter that allow to select a
>> publication based, for example, on the repository.
>>
>>
>> https://pulp-rpm.readthedocs.io/en/latest/restapi.html#operation/publications_rpm_rpm_list
>>
>> Also, to get the href at the creation of the publication will help and
>> reduce the number of task.
>>
>> Is there any solution I did not see?
>>
>> Juan
>> --
>>
>> Juan CABRERA
>> Correspondant informatique
>> Département de Mathématiques
>>
>> T. 081724919
>> juan.cabrera at unamur.be
>> http://staff.unamur.be/jbcabrer
>>
>> Université de Namur ASBL
>> Rue de Bruxelles 61 - 5000 Namur
>> Belgique
>>
>> Let’s respect the environment together.
>> Only print this message if necessary!
>> _______________________________________________
>> Pulp-list mailing list
>> Pulp-list at redhat.com
>> https://www.redhat.com/mailman/listinfo/pulp-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/pulp-list/attachments/20190527/996c4343/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ceabgghlbkmffbfa.png
Type: image/png
Size: 9356 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/pulp-list/attachments/20190527/996c4343/attachment.png>


More information about the Pulp-list mailing list