Bug #36669
openPUT /katello/api/repositories/:id fails when only updating docker_tags_whitelist
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.
- 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.
Updated by Jeremy Lenz over 1 year 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
Updated by Ian Ballou over 1 year ago
- Target version changed from Katello 4.9.2 to Katello 4.11.0