Bug #35927
closedSome custom repositories are failing to synchorize with error "This field may not be blank" after upgrading to Katello 4.3
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=2149893
Description of problem:
There are a couple of users who have reported this issue i.e.
- After upgrading to Katello 4.3, Some of the custom repositories are failing to get synced with the following error.
~~
Exception:
PulpRpmClient::ApiError: Error message: the server returns an error
HTTP status code: 400
Response headers: {"Date"=>"Wed, 09 Nov 2022 15:07:29 GMT", "Server"=>"gunicorn", "Content-Type"=>"application/json", "Vary"=>"Accept,Cookie", "Allow"=>"GET, PUT, PATCH, DELETE, HEAD, OPTIONS", "X-Frame-Options"=>"DENY", "Content-Length"=>"89", "X-Content-Type-Options"=>"nosniff", "Referrer-Policy"=>"same-origin", "Correlation-ID"=>"ac17a33d-bea6-44e8-85b0-fd166cbd806d", "Access-Control-Expose-Headers"=>"Correlation-ID", "Via"=>"1.1 foreman.example.com", "Connection"=>"close"}
Response body: {"username":["This field may not be blank."],"password":["This field may not be blank."]}
~~
- Inspecting the repository from Content --> Products page, does not shows any username or password mentioned in the Upstream Authorization field as well.
Version-Release number of selected component (if applicable):
Katello 4.3 and above
How reproducible:
100%
Steps to Reproduce:
1) On Katello 4.1, create a repository with empty strings for the upstream username and password.
2) Upgrade from Katello 4.1 to 4.3 and try syncing a repository from hammer
Actual results:
Sync fails with this error logged in production.log
2022-11-09T08:48:33 [E|bac|075bdbe0] Error message: the server returns an error
075bdbe0 | HTTP status code: 400
075bdbe0 | Response headers: {"Date"=>"Wed, 09 Nov 2022 14:48:33 GMT", "Server"=>"gunicorn", "Content-Type"=>"application/json", "Vary"=>"Accept,Cookie", "Allow"=>"GET,
PUT, PATCH, DELETE, HEAD, OPTIONS", "X-Frame-Options"=>"DENY", "Content-Length"=>"89", "X-Content-Type-Options"=>"nosniff", "Referrer-Policy"=>"same-origin", "Correlation
-ID"=>"075bdbe0-e38d-4c47-819f-27ca7182d620", "Access-Control-Expose-Headers"=>"Correlation-ID", "Via"=>"1.1 foreman.example.com", "Connection"=>"close"}
075bdbe0 | Response body: {"username":["This field may not be blank."],"password":["This field may not be blank."]} (PulpRpmClient::ApiError)
075bdbe0 | /opt/theforeman/tfm/root/usr/share/gems/gems/pulp_rpm_client-3.17.4/lib/pulp_rpm_client/api_client.rb:83:in `call_api'
075bdbe0 | /opt/theforeman/tfm/root/usr/share/gems/gems/pulp_rpm_client-3.17.4/lib/pulp_rpm_client/api/remotes_rpm_api.rb:318:in `partial_update_with_http_info'
075bdbe0 | /opt/theforeman/tfm/root/usr/share/gems/gems/pulp_rpm_client-3.17.4/lib/pulp_rpm_client/api/remotes_rpm_api.rb:262:in `partial_update'
075bdbe0 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.3.0.50/app/services/katello/pulp3/repository.rb:150:in `remote_partial_update'
075bdbe0 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.3.0.50/app/services/katello/pulp3/repository.rb:138:in `update_remote'
And then, running this command against the concerned repo id fixes the issue:
- hammer repository update --id XXX --upstream-username='' --upstream-password=''
Expected results:
No such errors and no such manual actions should be needed.
Additional info:
I believe a part of the improvement was done via BZ https://bugzilla.redhat.com/show_bug.cgi?id=2064793 | https://github.com/Katello/katello/pull/10018/files , due to which using "hammer repository update" we can fix the issue now but There should be some sort of migration script present that runs during upgrade, checks this inconsistency of values set for username\password between katello and pulpcore and fixes the same.
As an end user, I should not need to run any additional commands to fix all my custom repos.