Project

General

Profile

Actions

Bug #36669

open

PUT /katello/api/repositories/:id fails when only updating docker_tags_whitelist

Added by William Clark almost 2 years ago. Updated over 1 year ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Repositories
Target version:
-
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=2126803

Description of problem:
In Katello 4.5 the "docker_tags_whitelist" parameter of a repository is deprecated in favor of include_tags/exclude_tags. Nevertheless I would expect that parameter to work.

Trivial reproducer is something like the following curl call:
  1. curl -k -d '{"docker_tags_whitelist":["lol"]}' -u admin:changeme -H 'Content-Type: application/json' -X PUT https://localhost/katello/api/repositories/1 {"displayMessage":"Missing values for repository.","errors":["param is missing or the value is empty: repository"]}

This has worked in the past and works if I replace docker_tags_whitelist with include_tags.

The stacktrace in production.log looks like this:
2022-09-14T11:58:11 [I|app|bbbdb6f8] Started PUT "/katello/api/repositories/1" for 127.0.0.1 at 2022-09-14 11:58:11 +0000
2022-09-14T11:58:11 [I|app|bbbdb6f8] Processing by Katello::Api::V2::RepositoriesController#update as */*
2022-09-14T11:58:11 [I|app|bbbdb6f8] Parameters: {"docker_tags_whitelist"=>["lol"], "api_version"=>"v2", "id"=>"1", "repository"=>{}}
2022-09-14T11:58:11 [I|app|bbbdb6f8] Authorized user admin(Admin User)
2022-09-14T11:58:11 [E|app|bbbdb6f8] ActionController::ParameterMissing: param is missing or the value is empty: repository
bbbdb6f8 | /usr/share/gems/gems/actionpack-6.0.4.7/lib/action_controller/metal/strong_parameters.rb:462:in `require'
bbbdb6f8 | /usr/share/gems/gems/katello-4.5.0.6/app/controllers/katello/api/v2/repositories_controller.rb:534:in `repository_params'
bbbdb6f8 | /usr/share/gems/gems/katello-4.5.0.6/app/controllers/katello/api/v2/repositories_controller.rb:345:in `update'

Version-Release number of selected component (if applicable):
rubygem-katello-4.5.0.6-1.el8sat.noarch

How reproducible:
100%

Steps to Reproduce:
1. hammer product create --name lol --organization "Default Organization"
2. hammer repository create --name lol --content-type docker --product lol --organization "Default Organization"
3. curl -k -d '{"docker_tags_whitelist":["lol"]}' -u admin:changeme -H 'Content-Type: application/json' -X PUT https://localhost/katello/api/repositories/1

Actual results: {"displayMessage":"Missing values for repository.","errors":["param is missing or the value is empty: repository"]}

Expected results:
Repository updated

Additional info:
This still works via hammer (hammer -d repository update --name lol --product lol --organization "Default Organization" --docker-tags-whitelist lol) because hammer for some (unnecessary) reason sends a slightly different payload {"name":"lol", "docker_tags_whitelist":["lol"]} and that gets accepted by the API.

Actions #1

Updated by Jeremy Lenz almost 2 years ago

  • Subject changed from PUT /katello/api/repositories/:id fails when only updating docker_tags_whitelist to PUT /katello/api/repositories/:id fails when only updating docker_tags_whitelist
  • Target version set to Katello 4.9.2
  • Triaged changed from No to Yes
Actions #2

Updated by Ian Ballou over 1 year ago

  • Target version changed from Katello 4.9.2 to Katello 4.11.0
Actions #3

Updated by Ian Ballou over 1 year ago

  • Target version deleted (Katello 4.11.0)
Actions

Also available in: Atom PDF