Perform a force full sync for a particular repository in the Capsule Server

Solution Verified - Updated

Environment

  • Red Hat Satellite 6

Issue

  • Corrupted repository metadata.
  • Broken symlinks in published directory when using "immediate" download policy.
  • Missing content units, such as rpms in a repository.
  • Capsule repository content not in sync.

Resolution

  • Run the following command on the Red Hat Satellite server to access the foreman console

    # foreman-rake console
    
  • List all the Red Hat Capsule servers and their id that are attached to the Red Hat Satellite server

    pp SmartProxy.select(:id, :name).all.map(&:attributes)
    
  • Set the desire Capsule

    capsule = SmartProxy.find(<CAPSULE ID>)
    
  • Set the desire Organization

    org = Organization.find_by_name!("<ORGANIZATION NAME>")
    
  • Force full sync a particular repository in the Red Hat Capsule server

    • List the repositories that can be synced. The output format is "[repo_id, repo_name, environment name, content view]"

        capsule.lifecycle_environments.where(organization_id: org.id).each{|lce| lce.repositories.sort_by(&:name).map{|r| p [r.id, r.name, r.environment.name, r.content_view.name]}}
      
    • Perform repository sync

        ForemanTasks.async_task(Actions::Katello::CapsuleContent::Sync, capsule, repository_id: <REPO ID>, skip_metadata_check: true)
      
  • Force full sync a particular content view in a lifecycle environment in the Red Hat Capsule server

    • List all lifecycle environments available to the Capsule

        pp capsule.lifecycle_environments.where(organization_id: org.id).select(:id, :name).sort_by(&:id)
      
    • List all content view available to the Capsule

        pp capsule.lifecycle_environments.where(organization_id: org.id, id: <LIFECYCLE ENVIRONMENT ID>).map(&:content_views)
      
    • Sync a particular content view

        ForemanTasks.async_task(Actions::Katello::CapsuleContent::Sync, capsule, content_view_id: <CONTENT VIEW ID>, environment_id: <LIFECYCLE ENVIRONMENT ID>, skip_metadata_check: true)
      
  • Alternatively to sync a particular life cycle environment to the capsule using hammer:

    # hammer capsule content synchronize --lifecycle-environment <LE-name> --name <capsule-fqdn> --organization-id <org-id> --skip-metadata-check true
    
  • You can check the task status from Web UI -> Monitor -> Tasks page

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

SBR
Product(s)
Components
Category

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.