Bug 1667129

Summary: Providing custom=false to products controller does not filter out custom products
Product: Red Hat Satellite Reporter: John Mitsch <jomitsch>
Component: RepositoriesAssignee: John Mitsch <jomitsch>
Status: CLOSED ERRATA QA Contact: vijsingh
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.3.0CC: egolov, jomitsch
Target Milestone: 6.5.0Keywords: Regression, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-3.10.0.14-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-14 12:39:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description John Mitsch 2019-01-17 14:25:44 UTC
If I provide custom=false I still get custom products, see:  https://github.com/Katello/katello/blob/b7dc5d44d9d2af3b64a0c063a67f1e810be891cb/app/controllers/katello/api/v2/products_controller.rb#L50

Steps to Reproduce

* Access products API with custom=false (or any other value for that matter) - /katello/api/v2/organizations/1/products/?custom=false 
* Notice that only custom products are returned regardless of the value supplied to custom

Comment 1 John Mitsch 2019-01-17 14:25:46 UTC
Created from redmine issue https://projects.theforeman.org/issues/25180

Comment 2 John Mitsch 2019-01-17 14:25:48 UTC
Upstream bug assigned to jomitsch

Comment 3 John Mitsch 2019-01-17 14:27:50 UTC
I cloned this from redmine since this issue affects the dropdown in the RH repos page products filter. Users with a lot of custom products will find that filter frustrating to use since the custom products won't show on that page.

Comment 6 Bryan Kearney 2019-01-21 21:07:15 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25180 has been resolved.

Comment 9 John Mitsch 2019-01-30 13:52:52 UTC
The way it works is a little confusing at first, but this is how our booleans currently work in the Katello API:

There are two params, custom and redhat_only, they work with truthy values only

custom=true -> only return custom products
custom=false -> do nothing, return all products
redhat_only=true -> only return redhat products
redhat_only=false -> do nothing, return all products

To return only redhat products and no custom ones, use 'redhat_only=true'

This has been the pattern for booleans in our API, so we decided to continue with it and not introduce another pattern

Comment 11 vijsingh 2019-01-31 05:28:36 UTC
Verified:

@Satellite 6.5.0 Snap 13.0

steps/observation:

 There are two params, custom and redhat_only, they work with truthy values only

custom=true -> only return custom products
custom=false -> do nothing, return all products
redhat_only=true -> only return redhat products
redhat_only=false -> do nothing, return all products

Comment 14 errata-xmlrpc 2019-05-14 12:39:53 UTC
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-2019:1222