Project

General

Profile

Actions

Bug #38076

open

The content view APIs will pass repository_ids to the code both as a list of int or a list of strings

Added by Quirin Pamp 8 days ago. Updated 6 days ago.

Status:
Ready For Testing
Priority:
Normal
Assignee:
Category:
Content Views
Target version:
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

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.


Related issues 1 (1 open0 closed)

Related to Katello - Feature #38048: Add rolling content viewsReady For TestingQuirin PampActions
Actions #1

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
Actions #2

Updated by Quirin Pamp 8 days ago

Actions #3

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
Actions #4

Updated by Ian Ballou 6 days ago

  • Category set to Content Views
  • Triaged changed from No to Yes
Actions

Also available in: Atom PDF