How to regenerate repodata in Satellite for multiple repositories when packages are missing

Solution Unverified - Updated

Environment

Satellite 6

Issue

  • How to regenerate metadata for multiple repositories at a time
  • Unable to see specific packages under a repo on a client after synchronization of repositories was successful
  • Red Hat Satellite is not regenerating repodata

Resolution

IMPORTANT: This will trigger a task for each repository in the organization that can take some time to complete. Expect system usage to spike. Not recommended to run this in any automation form, but on an as-needed bases only

In order to regenerate metadata for all repositories in a specific organization follow the steps below: 

Step 1:

# hammer organization list (to see all of the organizations on your satellite along with their organization id)

Step 2:
NOTE: You would replace the organization id in this command with the specific id that belongs to the particular organization.

# for i in $(hammer --csv repository list --organization-id 1 | cut -d',' -f1); do curl -H "Content-Type:application/json" -X PUT -s -k -u admin:redhat https://satellite.example.com/katello/api/v2/repositories/$i/republish?organization_id=<ORG ID# HERE>; done

Example:

# for i in $(hammer --csv repository list --organization-id 1 | cut -d',' -f1); do curl -H "Content-Type:application/json" -X PUT -s -k -u admin:redhat https://satellite.example.com/katello/api/v2/repositories/$i/republish?organization_id=1; done

For more KB articles/solutions related to Red Hat Satellite 6.x Repository Issues, please refer to the Red Hat Satellite Consolidated Troubleshooting Article for Red Hat Satellite 6.x Repository Issues.

Root Cause

To regenerate repodata manually from the Satellite Webui you would do the following:

Sat Webui > Content > Products > Select the product the package missing is coming from > Click on repository name > Click on “select action” drop down box on the top right > Select Republish Repository Metadata > Verify from the tasks page that this task is running 
  • It is time-consuming to perform all of these steps for each individual repository when you need to regenerate repodata for multiple repositories.
SBR
Product(s)
Components

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.