Bug 1127589
Summary: | API Missing routes for repositories | ||
---|---|---|---|
Product: | Red Hat Satellite | Reporter: | Peter Vreman <peter.vreman> |
Component: | API | Assignee: | Bryan Kearney <bkearney> |
Status: | CLOSED ERRATA | QA Contact: | jaudet |
Severity: | medium | Docs Contact: | |
Priority: | unspecified | ||
Version: | 6.0.3 | CC: | bbuckingham, sthirugn |
Target Milestone: | Unspecified | Keywords: | Triaged |
Target Release: | Unused | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2015-08-12 05:13:44 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 1122832 |
Description
Peter Vreman
2014-08-07 08:20:29 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been set to ? to ensure that it is properly evaluated for this release. I believe that these can be addressed upstream. I am moving to ON_QE to verify. organizations/<id>/repositories is expressed as http://localhost:3330/katello/api/v2/repositories?organization_id=<id> products/<id>/repositories is expressed as http://localhost:3330/katello/api/v2/repositories?organization_id=<id>&product_id=<id> products/<id>/repositories is expressed as http://localhost:3330/katello/api/v2/repositories?organization_id=<id>&environment_id=<id> It is possible to fetch a set of repositories filtered according to the organization, product and environment that the repositories belong to. As proof, here's a python script that I executed: #!/usr/bin/env python from robottelo import entities from nailgun import client from robottelo.common.helpers import get_server_credentials # Start by creating an organization, product and repository. ORG_ID = entities.Organization().create_json()['id'] PROD_ID = entities.Product(organization=ORG_ID).create_json()['id'] REPO_ID = entities.Repository(product=PROD_ID).create_json()['id'] # Read back data from the server using suggested paths. First provide just an # organization ID. response = client.get( entities.Repository().path(), verify=False, auth=get_server_credentials(), data={'organization_id': ORG_ID} ) print(response.status_code) print(response.json()['total']) # Second, provide an organization and product ID. response = client.get( entities.Repository().path(), verify=False, auth=get_server_credentials(), data={'organization_id': ORG_ID, 'product_id': PROD_ID} ) print(response.status_code) print(response.json()['total']) # Third, provide an organization and environment ID. The environment ID should # not match anything. response = client.get( entities.Repository().path(), verify=False, auth=get_server_credentials(), data={'organization_id': ORG_ID, 'environment_id': 123456} ) print(response.status_code) print(response.json()['total']) And here's the output: 200 1 200 1 200 0 This bugzilla is about inconsistency in the API routes. See below the difference in routes for repositories, cotnent_views and products: - The repositories does not have a /organizations/ route - The repositories does have a /content_views/, but not a /products/ route api :GET, "/repositories", N_("List of enabled repositories") api :GET, "/content_views/:id/repositories", N_("List of repositories for a content view") param :organization_id, :number, :required => true, :desc => N_("ID of an organization to show repositories in") param :product_id, :number, :desc => N_("ID of a product to show repositories of") For example the content_views has a route with /organizations/ api :GET, "/organizations/:organization_id/content_views", N_("List content views") api :GET, "/content_views", N_("List content views") param :organization_id, :number, :desc => N_("organization identifier"), :required => true And products has even more routes: api :GET, "/products", N_("List products") api :GET, "/subscriptions/:subscription_id/products", N_("List of subscription products in a subscription") api :GET, "/activation_keys/:activation_key_id/products", N_("List of subscription products in an activation key") api :GET, "/organizations/:organization_id/products", N_("List of products in an organization") param :organization_id, :number, :desc => N_("Filter products by organization"), :required => true Still open, also for Sat6.1.0 that has only content_views/ route /opt/rh/ruby193/root/usr/share/gems/gems/katello-2.2.0.51/app/controllers/katello/api/v2# grep GET repositories_controller.rb api :GET, "/repositories", N_("List of enabled repositories") api :GET, "/content_views/:id/repositories", N_("List of repositories for a content view") api :GET, "/repositories/:id", N_("Show a custom repository") api :GET, "/repositories/:id/gpg_key_content", N_("Return the content of a repo gpg key, used directly by yum") This bug is slated to be released with Satellite 6.1. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2015:1592 |