Project

General

Profile

Bug #27242

Update the CDN url may break the repositories' feed url

Added by Hao Yu 3 months ago. Updated 3 months ago.

Status:
Closed
Priority:
High
Assignee:
-
Category:
Repositories
Target version:
Difficulty:
Triaged:
Yes
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

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.

Associated revisions

Revision 362cf7f0 (diff)
Added by Hao Yu 3 months ago

Fixes #27242 - Update CDN url might break feed url.

When updating the CDN url, some repositories' url are updating
multiple times in a single foreman task if they are used in any
content view. This causes the url path to replace by an empty
string due to a bug in the code that can't handle url update
multiple time safely. This commit fixed the issue.

History

#1 Updated by Hao Yu 3 months ago

  • Category set to Repositories

#2 Updated by The Foreman Bot 3 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/8199 added

#3 Updated by Jonathon Turel 3 months ago

  • Triaged changed from No to Yes
  • Target version set to Katello 3.13.0

#4 Updated by Hao Yu 3 months ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF