Bug 1256717

Summary: Cannot list non-custom products and repositories from the API
Product: Red Hat Satellite Reporter: Barak Korren <bkorren>
Component: Content ManagementAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED CURRENTRELEASE QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: urgent    
Version: 6.1.0CC: bbuckingham, bkearney, bkorren, mhulan
Target Milestone: UnspecifiedKeywords: 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: 2016-12-02 09:56:56 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: 1338516    

Description Barak Korren 2015-08-25 10:32:54 UTC
Description of problem:
Listing or searching for products in all the product APIs only shows custom products. This is despite the fact that non custom (RedHat) products show up in the UI when using the same account and organization used to access the API.
Also note that if querying the products API while specifying a product id details are returned for a non-custom product the same way they are returned for a custom product.
The above is also true for repositories.

Version-Release number of selected component (if applicable):
6.1.1

How reproducible:
Easily

Steps to Reproduce:
1. Install Satellite
2. Add subscriptions
3. Create some custom products
4. Attempt to list or search products from the API

Actual results:
Only custom products are returned in search results.

Expected results:
All products should return in search results.

Additional info:
This prevents scripts from discovering non-custom products and repositories in order to link them to content views for example.

Comment 2 Brad Buckingham 2016-05-02 17:51:14 UTC
Hi Barak,

Can you confirm the APIs that you were using for the above scenario?

From some testing on Satellite 6.2 Beta, I see the following behavior; however, I want to make sure these are the same APIs you were using:

GET katello/api/v2/organizations/1/products - lists RH and custom products (PASS)

GET katello/api/v2/organizations/1/products?custom=true - lists only custom products (PASS)

GET katello/api/v2/organizations/1/products?custom=false - lists only custom products (FAIL)

Comment 3 Barak Korren 2016-05-04 08:03:52 UTC
Hi, This had been a while ago, and done via NailGun, but as far as I can gather, the API I mostly looked into was this:

https://satellite6-ops.rhev-ci-vms.eng.rdu2.redhat.com/katello/api/v2/products?organization_id=1

(Lists only custom products on 6.1.7 which is what I have atm)

Note that this is typical to how NailGun works, it typically looks at the topmost URL for a given entity type, not the one nested inside other entities (It is hard to write a generic SDK otherwise, because you would need a lot of entity-specific nesting information).

Comment 4 Bryan Kearney 2016-07-26 15:25:24 UTC
Moving 6.2 bugs out to sat-backlog.

Comment 5 Bryan Kearney 2016-07-26 15:41:10 UTC
Moving 6.2 bugs out to sat-backlog.

Comment 9 Marek Hulan 2016-12-02 09:56:56 UTC
I verified that it works as expected on 6.2.5 with queries like this

# lists all products
curl https://admin:changeme@sat.example.tst/katello/api/v2/products\?organization_id\=1

# list redhat only
curl https://admin:changeme@sat.example.tst/katello/api/v2/products\?organization_id\=1\&search\='not custom'

# list custom only
curl https://admin:changeme@sat.example.tst/katello/api/v2/products\?organization_id\=1\&search\='custom'

Barak it would be great if you could verify, please let us know if you still experience any issues in 6.2.