Project

Profile

Help

Issue #6897

closed

pulp_deb_client gem has different interface than other pulp_*_client gems

Added by mbucher over 4 years ago. Updated over 3 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version - Debian:
master
Platform Release:
Target Release - Debian:
OS:
Triaged:
No
Groomed:
No
Sprint Candidate:
No
Tags:
API Bindings, Katello
Sprint:
Quarter:

Description

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.

Actions #1

Updated by quba42 over 4 years 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.

Actions #2

Updated by mbucher over 4 years 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/openapigenerator.py (here)

Actions #3

Updated by quba42 over 4 years 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...

Actions #4

Updated by mdellweg over 4 years ago

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

Actions #5

Updated by mbucher over 4 years ago

Added a draft-PR for the renaming: https://github.com/pulp/pulp_deb/pull/180

Feel free to test and comment.

Added by mbucher over 4 years ago

Revision 1d5c8642 | View on GitHub

Refactor class-names to Apt..

fixes #6897

Actions #6

Updated by quba42 over 4 years ago

  • Status changed from NEW to POST
Actions #7

Updated by quba42 over 4 years ago

  • Status changed from POST to NEW
Actions #8

Updated by quba42 over 4 years ago

  • Status changed from NEW to POST
Actions #9

Updated by mbucher over 4 years ago

  • Status changed from POST to MODIFIED
Actions #10

Updated by quba42 over 3 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF