Bug #36987
closedparam :source_url not working with the sync API
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=2249109
Description of problem:
- When using Hammer to sync a repository, the option --source-url is not used for the sync, it will use existing url.
- However, when I pass --source-url on a repo with no existing url, it will try and sync, not giving a hammer error,
and will fail with HTTP 400: Server Error for no remote.
Version-Release number of selected component (if applicable):
Since pulp3 upgrade
How reproducible:
Every time
Steps to Reproduce:
1. Create some repository with no upstream_url defined. (--url in hammer).
2. >> hammer repository synchronize --id {repo_id} --source-url {valid_source_url}
3. Add a valid url to the repository field upstream_url (--url in hammer).
4. >> hammer repository synchronize --id {repo_id} --source-url {some_other_valid_url}
Actual results:
2: Unsuccessful sync, does not use --source_url, gives 400 error that there is no remote (See Additional details).
4: The repository is synced to the existing url, instead of respecting the temporary --source-url passed.
Expected results:
Successful sync to the temporary '--source-url' passed in 'hammer repository synchronize'.
Or we can drop references to '--source-url', if we do not plan to support it.
Additional details:
- When synchronizing a repository that has no existing url, and passed --source-url:
[root@HOST ~]# hammer repository synchronize --id 362 --source-url "https://partha.fedorapeople.org/test-repos/pteradactyl/"
[................................................................................................................] [100%]
Error: Error message: the server returns an error
HTTP status code: 400
Response headers: {"Date"=>"Fri, 10 Nov 2023 16:02:17 GMT", "Server"=>"gunicorn", "Content-Type"=>"application/json", "Vary"=>"Accept,Cookie", "Allow"=>"POST, OPTIONS", "X-Frame-Options"=>"DENY", "Content-Length"=>"82", "X-Content-Type-Options"=>"nosniff", "Referrer-Policy"=>"same-origin", "Cross-Origin-Opener-Policy"=>"same-origin", "Correlation-ID"=>"***", "Access-Control-Expose-Headers"=>"Correlation-ID", "Via"=>"1.1 HOSTNAME.redhat.com", "Connection"=>"close"}
Response body: {"remote":["This field is required since a remote is not set on the repository."]}
^^ Instead, would expect source_url to be used for sync, or a hammer error like-
""" Could not synchronize the repository:
attempted to sync without a feed URL. """
- When synchronizing a repository that has an existing url that was already synced,
perform sync again passing a different --source-url:
[root@HOST ~]# hammer repository synchronize --id 363 --source-url "https://partha.fedorapeople.org/test-repos/pteradactyl/"
[................................................................................................................] [100%]
No content added.
Total steps: 1/1
--------------------------------
Skipping Sync (no change from previous sync): 1/1
Updated by The Foreman Bot about 1 year ago
- Status changed from New to Ready For Testing
- Assignee set to Samir Jha
- Pull request https://github.com/Katello/katello/pull/10827 added
Updated by The Foreman Bot about 1 year ago
- Fixed in Releases Katello 4.12.0 added
Updated by Samir Jha about 1 year ago
- Status changed from Ready For Testing to Closed
Applied in changeset katello|58f498787ffef5db04920462591bf6f7f6117e36.
Updated by Jeremy Lenz about 1 year ago
- Subject changed from param :source_url not working with the sync API to param :source_url not working with the sync API
- Target version set to Katello 4.12.0
- Triaged changed from No to Yes