Description of problem: Working with repositories does not support Routes to access the data with organizations/<id>/repositories products/<id>/repositories environments/<id>/repositories # curl -K /opt/hoici/etc/curl-hoici.conf -H 'Content-Type: application/json' -d '{"per_page":"9999"}' -XGET https://localhost/katello/api/v2/repositories {"displayMessage":"One of parameters [ organization_id ] required but not specified.","errors":["One of parameters [ organization_id ] required but not specified."]} # curl -K /opt/hoici/etc/curl-hoici.conf -H 'Content-Type: application/json' -d '{"per_page":"9999"}' -XGET https://localhost/katello/api/v2/organizations/4/repositories orepositories <title>The page you were looking for doesn't exist (404)</title> # curl -K /opt/hoici/etc/curl-hoici.conf -H 'Content-Type: application/json' -d '{"per_page":"9999"}' -XGET https://localhost/katello/api/v2/products/5/repositories {"displayMessage":"undefined method `[]' for nil:NilClass","errors":["undefined method `[]' for nil:NilClass"]} Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info:
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