Bug 1727493 - Update the CDN url may break the repositories' feed url
Summary: Update the CDN url may break the repositories' feed url
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Content Management
Version: 6.5.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.6.0
Assignee: Hao Chang Yu
QA Contact: Lai
URL:
Whiteboard:
: 1753794 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-07-07 01:30 UTC by Hao Chang Yu
Modified: 2020-09-20 12:32 UTC (History)
10 users (show)

Fixed In Version: tfm-rubygem-katello-3.12.0.9-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1756054 (view as bug list)
Environment:
Last Closed: 2019-10-22 19:47:19 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
hotfix tfm-rubygem-katello RPM (11.67 MB, application/x-rpm)
2019-10-07 13:38 UTC, wclark
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 27242 0 High Closed Update the CDN url may break the repositories' feed url 2020-12-29 05:30:29 UTC
Github Katello katello pull 8199 0 'None' closed Fixes #27242 - Update CDN url might break feed url. 2020-12-29 05:30:27 UTC
Red Hat Knowledge Base (Solution) 4537471 0 None None None 2019-10-28 23:15:26 UTC

Description Hao Chang Yu 2019-07-07 01:30:23 UTC
Description of problem:
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 is used by any content view, Satellite will update its feed url X(number of CVs used it) + 1 times. Thus, break the feed url. The path of the feed url will be replaced with an empty string.

For example, If I change my CDN repo to "http://satellite.example.com/pub/exports"

Before updating:
https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/os

After updating, the feed url will become:
http://satellite.example.com/pub/exports


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 for the same repositories. This may cause serious performance impact for large environment.


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

Steps to Reproduce:
1. Enable any Red Hat Repository
2. Create a CV and add that repository to the CV, publish and promote the CV.
3. Change the CDN url and wait for the task to finish.
4. Check the feed url of the repository in the web ui.

Comment 6 Bryan Kearney 2019-07-15 18:04:46 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/27242 has been resolved.

Comment 10 Brad Buckingham 2019-09-26 15:04:50 UTC
*** Bug 1753794 has been marked as a duplicate of this bug. ***

Comment 11 wclark 2019-10-07 13:38:26 UTC
Created attachment 1623131 [details]
hotfix tfm-rubygem-katello RPM

A hotfix RPM has been built for this bug. The installation instructions:

1. Download the hotfix RPM from this bug and copy it to satellite server

2. # yum localinstall /path/to/hotfix/RPM

3. # systemctl restart httpd

Comment 12 Bryan Kearney 2019-10-22 19:47:19 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:3172

Comment 13 wclark 2019-10-23 19:14:49 UTC
Note that 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 HF or upgrade to Satellite 6.6

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

Comment 14 wclark 2019-10-23 19:18:59 UTC
Additional note for customers who install the Hotfix: restarting httpd alone is insufficient and dynflowd needs to be restarted as well.

UPDATED HF installation instructions:

1. Download the hotfix RPM from this bug and copy it to satellite server

2. # yum localinstall /path/to/hotfix/RPM

3. # systemctl restart httpd dynflowd


Note You need to log in before you can comment on or make changes to this bug.