Issue #6897

pulp_deb_client gem has different interface than other pulp_*_client gems

Added by mbucher 5 months ago. Updated 4 months ago.

Start date:
Due date:
Estimated time:
2. Medium
Version - Debian:
Platform Release:
Target Release - Debian:
Sprint Candidate:
API Bindings, Katello


Found during Katello integration. In the pulp_deb_client gem, the method for listing repository-versions expects a primary-key instead of an href, which all other client gems do:

module PulpDebClient
  class RepositoriesDebVersionsApi
    def list(apt_repository_pk, opts = {})
module PulpFileClient
  class RepositoriesFileVersionsApi
    def list(file_repository_href, opts = {})

I would make a PR, but I have no clue, where this goes wrong.

Associated revisions

Revision 1d5c8642 View on GitHub
Added by mbucher 4 months ago

Refactor class-names to Apt..

fixes #6897


#1 Updated by quba42 5 months ago

I can confirm that this is the case. Having compared pulp_deb and pulp_file code a bit, I have no idea why this might be the case.

#2 Updated by mbucher 5 months ago

So the root of the problem seems to be that the model in pulp_deb is called DebRepository.

This results in the URL for a specific repository being created as: /pulp/api/v3/repositories/deb/apt/{deb_repository_pk}/

Notice the primary-key being referenced as deb_repository_pk, because this is auto-generated from the model-name.

The URL for listing the versions of a specific repository is created as: /pulp/api/v3/repositories/deb/apt/{apt_repository_pk}/versions/

Because the primary-key of the repository is represented by apt_repository_pk here, the OpenAPIGenerator is not able to match the prefix of this URL against the repository-URL and therefore leaves it as it is in the resulting api.json, which leads to the different pulp_deb_client-gem.

I believe we have to options here:

  1. rename the model-class to AptRepository as well as all other related model-classes
  2. create a new method in the Base-Model class that generates the primary-key parameter-name, which will give pulp_deb the option to overwrite it in DebRepository-class.

The primary-key parameter-name is currently generated in the get_pk_path_param_name_from_model()-method within pulpcore/app/ (here)

#3 Updated by quba42 5 months ago

I suppose AptRepostiory would actually be the "correct" name, given that we use the same repository type for Ubuntu, and are already using "/pulp/api/v3/repositories/deb/apt/" for the API path.

Sounds like it might be a pain to change though...

#4 Updated by mdellweg 5 months ago

I am fine with AptRepository if you can prove it works. The migration (renaming) it should not be too hard.

#5 Updated by mbucher 4 months ago

Added a draft-PR for the renaming:

Feel free to test and comment.

#6 Updated by quba42 4 months ago

  • Status changed from NEW to POST

#7 Updated by quba42 4 months ago

  • Status changed from POST to NEW

#8 Updated by quba42 4 months ago

  • Status changed from NEW to POST

#9 Updated by mbucher 4 months ago

  • Status changed from POST to MODIFIED

Please register to edit this issue

Also available in: Atom PDF