Bug #38076
openThe content view APIs will pass repository_ids to the code both as a list of int or a list of strings
Description
This is a problem, because https://github.com/Katello/katello/blob/master/app/lib/actions/katello/content_view/update.rb
performs set difference logic as follows:
repo_ids_to_remove = content_view.repository_ids - content_view_params[:repository_ids]
Here, content_view.repository_ids is taken from the DB and is always a list of integers.
content_view_params[:repository_ids] is passed in from the API and is sometimes a list of strings.
When the types diverge, the set difference logic breaks down.
The only reason this does not lead to noticeably buggy behaviour, is because the result of the set logic is only used to determine whether or not to enter an if block.
However, for rolling content views (https://projects.theforeman.org/issues/38048), we want to use identical logic and directly use the resulting lists.
We could fix this within the app/lib/actions/katello/content_view/update.rb action, but we think it makes more sense for the API to send consistently typed data to the backend.
Our proposal is to always cast the data received by the API from the user to a list of integers in the API controller.
PR will follow shortly.
Updated by Quirin Pamp 8 days ago
- Subject changed from The content view APIs will pass repository_ids to the code both as a list of int a list of strings to The content view APIs will pass repository_ids to the code both as a list of int or a list of strings
Updated by Quirin Pamp 8 days ago
- Related to Feature #38048: Add rolling content views added
Updated by The Foreman Bot 8 days ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/Katello/katello/pull/11253 added
Updated by Ian Ballou 6 days ago
- Category set to Content Views
- Triaged changed from No to Yes