Repository sync from disconnected Satellite not working

Solution Verified - Updated

Environment

Satellite 6.5

Issue

Synchronizing repositories using a custom CDN URL on a disconnected Satellite server is not working

Resolution

Apply the 'tfm-rubygem-katello' hotfix mentioned in the This content is not included.BZ 1727493

The installation instructions:

  1. Download the hotfix RPM from this bug and copy it to the satellite server
  2. # yum localinstall /path/to/hotfix/RPM
  3. # systemctl restart httpd dynflowdd

This patch alone won't automatically resolve any previously broken URLs since the patch fixes a bug with the task that updates the repository URLs when the CDN URL is changed. To fully resolve this issue, affected customers must:

  1. Install hotfix or upgrade to Satellite 6.6
  2. Re-trigger the task that updates repo URLs, by changing the CDN URL to something else than change it back to the desired setting (e.g. https://cdn.redhat.com for Satellites that pull content from the Red Hat CDN)

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

When updating the CDN URL, Satellite will trigger a foreman task to update the feed URL of all the Red Hat repositories to reflect the new base URL. If any of the Red Hat repositories are used by any content view, Satellite will update its feed URL X(number of content views used it) + 1 times. Thus, break the feed URL. The path of the feed URL will be replaced with an empty string.

In /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.48/app/lib/actions/katello/provider/update.rb

        def update_repository_urls(product, current_base_url, new_base_url)
          product.repositories.each do |repository|    <===============  "product.repositories" will include "library_instance_id != nil" repos.
            next unless repository.url
            path = repository.url.split(current_base_url)[1]  <========== Path will be ""(empty string) when updating the 2nd times.
            url = "#{new_base_url}#{path}"
            plan_action(::Actions::Katello::Repository::Update, repository.root, :url => url)  <===== Root repository will be updated multiple times
          end
        end

Due to this issue, it also caused many duplicate RegenerateMetadata tasks for the same repositories.

Diagnostic Steps

Steps to Reproduce:

  1. Enable any Red Hat Repository
  2. Create a content view and add that repository to the content view, publish and promote the content view.
  3. Change the CDN URL and wait for the task to finish.
  4. Check the feed URL of the repository on the webUI.
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.