Bug 2126803
| Summary: | PUT /katello/api/repositories/:id fails when only updating docker_tags_whitelist | ||
|---|---|---|---|
| Product: | Red Hat Satellite | Reporter: | Evgeni Golov <egolov> |
| Component: | Repositories | Assignee: | wclark |
| Status: | ASSIGNED --- | QA Contact: | Satellite QE Team <sat-qe-bz-list> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 6.11.0 | CC: | iballou, wclark |
| Target Milestone: | Unspecified | Keywords: | Regression, Triaged |
| Target Release: | Unused | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | Type: | Bug | |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Created redmine issue https://projects.theforeman.org/issues/36669 from this bug I couldn't reproduce this upstream, when I tried the curl command I got the below payload in rails console:
11:12:08 rails.1 | 2023-08-10T11:12:08 [I|app|c87995fd] Parameters: {"docker_tags_whitelist"=>["lol"], "api_version"=>"v2", "id"=>"1", "repository"=>{"docker_tags_whitelist"=>["lol"]}}
I'll try to reproduce it on Satellite 6.13 in a bit... if it still exists there, I'll figure out what commit fixes it so we can cherry-pick as necessary.
I can't get the error on upstream 4.9 either, but I am also not seeing the whitelist being set in the "include_tags" variable. Same with hammer! hammer -d repository update --name lol --product lol --organization "Default Organization" --docker-tags-whitelist WHAT -- succeeds hammer repository info --name lol --product lol --organization "Default Organization" -- doesn't show any "Container Image Tags Filter" Interesting. I got the same behavior on Satellite 6.13:
The PUT request succeeds, but within that response we have... "docker_tags_whitelist":[],"include_tags":[],"exclude_tags":["*-source"]
And the log:
==> /var/log/foreman/production.log <==
2023-08-10T19:49:39 [I|app|0edf6255] Started PUT "/katello/api/repositories/1" for ::1 at 2023-08-10 19:49:39 +0000
2023-08-10T19:49:39 [I|app|0edf6255] Processing by Katello::Api::V2::RepositoriesController#update as */*
2023-08-10T19:49:39 [I|app|0edf6255] Parameters: {"docker_tags_whitelist"=>["lol"], "api_version"=>"v2", "id"=>"1", "repository"=>{"docker_tags_whitelist"=>["lol"]}}
2023-08-10T19:49:39 [I|app|0edf6255] Authorized user admin(Admin User)
2023-08-10T19:49:39 [I|bac|0edf6255] Task {label: , execution_plan_id: fd227d59-c9c4-48d4-9fcc-906e59b40de8} state changed: pending
2023-08-10T19:49:39 [I|bac|0edf6255] Task {label: Actions::Katello::Repository::Update, id: eee45a84-ce3e-4eff-baad-4bd3ed1a9480, execution_plan_id: fd227d59-c9c4-48d4-9fcc-906e59b40de8} state changed: planning
2023-08-10T19:49:39 [I|aud|0edf6255] Katello::RootRepository (1) update event on docker_tags_whitelist , lol
2023-08-10T19:49:39 [I|bac|0edf6255] Task {label: Actions::Katello::Repository::Update, id: eee45a84-ce3e-4eff-baad-4bd3ed1a9480, execution_plan_id: fd227d59-c9c4-48d4-9fcc-906e59b40de8} state changed: planned
2023-08-10T19:49:39 [I|bac|0edf6255] Task {label: Actions::Katello::Repository::Update, id: eee45a84-ce3e-4eff-baad-4bd3ed1a9480, execution_plan_id: fd227d59-c9c4-48d4-9fcc-906e59b40de8} state changed: running
2023-08-10T19:49:39 [I|bac|0edf6255] Task {label: Actions::Katello::Repository::Update, id: eee45a84-ce3e-4eff-baad-4bd3ed1a9480, execution_plan_id: fd227d59-c9c4-48d4-9fcc-906e59b40de8} state changed: stopped result: success
2023-08-10T19:49:39 [I|app|0edf6255] Rendered /usr/share/gems/gems/katello-4.7.0.23/app/views/katello/api/v2/repositories/show.json.rabl within katello/api/v2/layouts/resource (Duration: 65.5ms | Allocations: 18753)
2023-08-10T19:49:39 [I|app|0edf6255] Rendered layout /usr/share/gems/gems/katello-4.7.0.23/app/views/katello/api/v2/layouts/resource.json.erb (Duration: 66.5ms | Allocations: 19020)
2023-08-10T19:49:39 [I|app|0edf6255] Completed 200 OK in 755ms (Views: 50.7ms | ActiveRecord: 80.4ms | Allocations: 89146)
Out of curiosity, I tried with '{"include_tags": ["lol"]}' instead, and the result is different... "docker_tags_whitelist":["lol"],"include_tags":["lol"],"exclude_tags":["*-source"]
I think that made it worse? The reported behaviour is "if I pass this deprecated param, it fails with a stupid error", now it's "if I pass this deprecated param, it's silently discarded and the system pretends success" |
Description of problem: In Satellite 6.12 (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: # 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 on 6.11 and works in 6.11 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 satellite-6.12.0-2.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.