Bug 2128080

Summary: Repository Sync status API is broken on Satellite 6
Product: Red Hat Satellite Reporter: Karnvir Singh <karnsing>
Component: RepositoriesAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED MIGRATED QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: high Docs Contact:
Priority: high    
Version: 6.10.4CC: ajchavan, apatel, chrobert, iballou, ofedoren, sadas, saydas, sdturne
Target Milestone: UnspecifiedKeywords: MigratedToJIRA, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-06-06 12:34:38 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 Karnvir Singh 2022-09-19 19:22:25 UTC
Description of problem:

Repository Sync status API is broken on Satellite 6 - /katello/api/repositories/:repository_id/sync

Version-Release number of selected component (if applicable):

6.10

How reproducible:

100%

Steps to Reproduce:

1. Run below API, provide ID of any repository. You can also initiate the sync of repository before running below API, it would still fail.

GET /katello/api/repositories/:repository_id/sync

2. API fails with 404 error.

Actual results:

API not showing the status and failing with 404 error.

Expected results:

It should show the sync status of repository.

Comment 5 Sayan Das 2023-01-20 17:15:43 UTC
This is the last way I found out to get Similar Results as what is displayed in Content --> Sync Status page


# curl -ksu admin:RedHat1! "https://`hostname -f`/foreman_tasks/api/tasks?search=label=Actions::Katello::Repository::Sync&&per_page=1000" | json_reformat | egrep "^                            \"text\": \"repository|                \"output\":"  | awk -F'":' '{print $NF"|"}' | paste - - | column -s"|" -t

 "repository 'Red Hat Enterprise Linux 7 Server - Extras RPMs x86_64'"                        	 "New packages: 26 (41.1 MB)."   
 "repository 'Red Hat Ansible Engine 2.9 RPMs for Red Hat Enterprise Linux 7 Server x86_64'"  	 "No new packages."   
 "repository 'Red Hat Satellite Tools 6.10 for RHEL 6 Server - ELS RPMs x86_64'"              	 "No new packages."   
 "repository 'Red Hat Ansible Engine 2.9 RPMs for Red Hat Enterprise Linux 7 Server x86_64'"  	 "No new packages."   
 "repository 'Red Hat Ansible Engine 2.9 RPMs for Red Hat Enterprise Linux 7 Server x86_64'"  	 "No new packages."   
 "repository 'Red Hat Enterprise Linux 6 Server - Extended Life Cycle Support RPMs x86_64'"   	 "No new packages."   
 "repository 'Red Hat Ansible Engine 2.9 RPMs for Red Hat Enterprise Linux 7 Server x86_64'"  	 "No new packages."   
 "repository 'Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server'"                         	 "No new packages."   
 "repository 'ubi8/ubi-minimal'"                                                              	 "No JSON object could be decoded"   
 "repository 'ubi8/ubi-minimal'"                                                              	 "No JSON object could be decoded"   
 "repository 'ubi8/ubi-minimal'"                                                              	 "No JSON object could be decoded"   
 "repository 'Red Hat Enterprise Linux 6 Server - Extended Life Cycle Support RPMs x86_64'"   	 "Processing metadata"   


Basically, I target all the "Actions::Katello::Repository::Sync" tasks , get their results and then grep for the repo name and results printed for each. But I limit the output to 1000 only. 

The output after "json_reformat" can be parsed much better with Python script instead of shell hacks.

The above output is for Pulp 2, For Pulp 3, We do have results but It's a bit messy due to the way 

 "repository 'Red Hat Software Collections RPMs for Red Hat Enterprise Linux 7 Server x86_64 7Server'",  	 "Added Rpms: 30, Errata: 1\nTotal steps: 16234/16234\n--------------------------------\nAssociating Content: 598/598\nDownloading Artifacts: 0/0\nDownloading Metadata Files: 10/10\nParsed Advisories: 690/690\nParsed Comps: 0/0\nParsed Packages: 14369/14369\nSkipping Packages: 0/0\nUn-Associating Content: 567/567",

 "repository 'Red Hat Ansible Engine 2.9 RPMs for Red Hat Enterprise Linux 7 Server x86_64'",            	 "No content added.\nTotal steps: 1/1\n--------------------------------\nSkipping Sync (no change from previous sync): 1/1",


If we use jq utility instead of json_reformat, we can get this for Pulp3 specific satellites

curl -ksu admin:RedHat1! "https://`hostname -f`/foreman_tasks/api/tasks?search=label=Actions::Katello::Repository::Sync&&per_page=1000" | jq '.results | .[] | [.input.repository.name,.humanized.output]'


[
  "Red Hat Software Collections RPMs for Red Hat Enterprise Linux 7 Server x86_64 7Server",
  "Added Rpms: 30, Errata: 1\nTotal steps: 16234/16234\n--------------------------------\nAssociating Content: 598/598\nDownloading Artifacts: 0/0\nDownloading Metadata Files: 10/10\nParsed Advisories: 690/690\nParsed Comps: 0/0\nParsed Packages: 14369/14369\nSkipping Packages: 0/0\nUn-Associating Content: 567/567"
]
[
  "Red Hat Ansible Engine 2.9 RPMs for Red Hat Enterprise Linux 7 Server x86_64",
  "No content added.\nTotal steps: 1/1\n--------------------------------\nSkipping Sync (no change from previous sync): 1/1"
]

Comment 6 Eric Helms 2024-06-06 12:34:38 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.

Comment 7 Red Hat Bugzilla 2024-10-05 04:25:29 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days