Bug 2249109

Summary: param :source_url not working with the sync API
Product: Red Hat Satellite Reporter: David Moore <damoore>
Component: RepositoriesAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED MIGRATED QA Contact: Sam Bible <sbible>
Severity: low Docs Contact:
Priority: low    
Version: 6.10.0CC: iballou, rlavi, sajha, sbible, zhunting
Target Milestone: streamKeywords: EasyFix, MigratedToJIRA, 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: 2024-06-06 16:32:20 UTC 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:

Description David Moore 2023-11-10 18:31:51 UTC
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):
6.10 and up
Reproduced on 6.15.0 snap 36.0

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

Comment 1 Brad Buckingham 2023-11-13 13:09:33 UTC
Is this a regression in behavior from a previous release?

Comment 5 Samir Jha 2023-12-14 18:33:54 UTC
Created redmine issue https://projects.theforeman.org/issues/36987 from this bug

Comment 6 Bryan Kearney 2023-12-20 16:02:45 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/36987 has been resolved.

Comment 8 Sam Bible 2024-03-27 17:37:17 UTC
Verified on Satellite Stream - snap 49

Steps to Verify:
1) Create a Repository.
2) Attempt to use --source-url argument for hammer repository syncronize

Expected Results:
--source-url isn't a recognized argument, and isn't listed as such in the help text

Actual Results:
--source-url isn't a recognized argument, and isn't listed as such in the help text

Comment 9 Eric Helms 2024-06-06 16:32:20 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.