This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2126803 - PUT /katello/api/repositories/:id fails when only updating docker_tags_whitelist
Summary: PUT /katello/api/repositories/:id fails when only updating docker_tags_whitelist
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Repositories
Version: 6.11.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: wclark
QA Contact: Satellite QE Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-09-14 12:52 UTC by Evgeni Golov
Modified: 2024-06-06 12:31 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2024-06-06 12:31:05 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 36669 0 Normal New PUT /katello/api/repositories/:id fails when only updating docker_tags_whitelist 2023-08-10 13:40:05 UTC
Red Hat Issue Tracker   SAT-18302 0 None Migrated None 2024-06-06 12:31:04 UTC

Description Evgeni Golov 2022-09-14 12:52:28 UTC
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.

Comment 2 wclark 2023-08-10 13:40:04 UTC
Created redmine issue https://projects.theforeman.org/issues/36669 from this bug

Comment 3 wclark 2023-08-10 15:48:28 UTC
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.

Comment 4 Evgeni Golov 2023-08-10 18:04:49 UTC
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"

Comment 5 wclark 2023-08-10 20:01:43 UTC
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"]

Comment 6 Evgeni Golov 2023-08-11 05:40:46 UTC
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"

Comment 7 Chris Roberts 2023-10-12 18:26:33 UTC
This has been removed upstream:

https://github.com/Katello/katello/commit/2292c98756554ab43f4942790466fb783e6a302c

Are we still wanting to try and fix this for downstream or just close it out since the param was depreciated?

Comment 8 Evgeni Golov 2023-10-13 06:22:36 UTC
Well, given it affects the latest released version (6.13) in a bad way (you pass a parameter which is silently ignored, pretending to have completed the operation successfully), I'd vote for fixing it?

Comment 10 Brad Buckingham 2023-10-30 11:29:29 UTC
Bulk setting Target Milestone = 6.15.0 where sat-6.15.0+ is set.

Comment 11 Brad Buckingham 2023-11-07 21:00:10 UTC
Based upon discussion with William and on this bugzilla, after investigation it appears that the issue only exists on releases prior to 6.15.  For this reason, I am dropping it from 6.15 and removing Triaged keyword for awareness by the triage team.

Comment 13 Eric Helms 2024-06-06 12:31:05 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "SAT-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.


Note You need to log in before you can comment on or make changes to this bug.