Bug 1257588
| Summary: | [RFE] API routes for repositories in consistent with filter on per product and per organization | ||
|---|---|---|---|
| Product: | Red Hat Satellite | Reporter: | Peter Vreman <peter.vreman> |
| Component: | API | Assignee: | satellite6-bugs <satellite6-bugs> |
| Status: | CLOSED ERRATA | QA Contact: | Jitendra Yejare <jyejare> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 6.1.0 | CC: | bbuckingham, bkearney, brubisch, jcallaha, jyejare, rjerrido, xdmoon |
| Target Milestone: | Unspecified | Keywords: | FutureFeature, Triaged |
| Target Release: | Unused | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Enhancement | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2018-02-21 12:30:53 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: | 260381, 1122832 | ||
Per 6.3 planning, moving out non acked bugs to the backlog This is fixed in 6.2.0Beta2. The repositories controller contains already more routes:
[crash] root@li-lc-1578:/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.47/app# grep 'GET.*/repositories' controllers/katello/api/v2/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, "/organizations/:organization_id/environments/:environment_id/repositories", _("List repositories in the environment")
api :GET, "/products/:product_id/repositories", N_("List of repositories for a product")
api :GET, "/environments/:environment_id/products/:product_id/repositories", N_("List of repositories belonging to a product in an environment")
api :GET, "/repositories/repository_types", N_("Show the available repository types")
api :GET, "/repositories/:id", N_("Show a repository")
api :GET, "/repositories/:id/gpg_key_content", N_("Return the content of a repo gpg key, used directly by yum")
Correction, this is not fully fixed in Sat6.2.0 GA. It still requires https://github.com/Katello/katello/pull/5999 In 6.2.12 the PR 5999 is still missing even that https://projects.theforeman.org/issues/14825 has release katello 3.0.0. I think the PR5999 is also included in 6.3 Per Peter's comment, moving to 6.3 for verification. Jake, can you ack this please? I verified it, it was still broken, below is the patch
--- controllers/katello/api/v2/repositories_controller.rb.171129-1 2017-11-28 13:59:07.795809864 +0000
+++ controllers/katello/api/v2/repositories_controller.rb 2017-11-29 15:19:46.639184122 +0000
@@ -394,6 +394,7 @@
def find_product
@product = Product.find(params[:product_id]) if params[:product_id]
+ find_organization_from_product if @organization.nil? && @product
end
def find_product_for_create
Peter
Thanks.. I will send this off ot the triage group Sorry, my failure. I mixed up with remove/apply my custom patches. The patch in comment 9 is not needed. For verification test 'GET /products/:product_id/repositories' of is enough to make sure the PR 5999 is applied. Peter Moving to ON_QA for verification. 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-2018:0336 |
Description of problem: The API routes for repositories are inconsistent there is no URL path to filter per organization and per product. See below the difference in routes for repositories, content_views and products: - The repositories does not have a /organizations/ route - The repositories does not have a /products/ 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 Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. API Call "/organizations/:organization_id/repositories" 2. API Call "/products/:product_id/repositories" 3. Actual results: Error Expected results: Return list of repositories Additional info: Followup from BZ1127589 that did not address the inconsistency in the API