Skip to content

Commit

Permalink
WIP: Fix enabled_repos detection
Browse files Browse the repository at this point in the history
structured_apt adds postfix to repository-paths, which have to be
stripped in order to be used for finding matching Katello::Repository
  • Loading branch information
m-bucher committed Oct 11, 2024
1 parent 295cf69 commit d866593
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/models/katello/host/content_facet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,12 @@ def update_repositories_by_paths(paths)
prefixes = %w(/pulp/deb/ /pulp/repos/ /pulp/content/)
relative_paths = []

# paths == ["/pulp/content/Default_Organization/Library/custom/Test_product/test2"]
# paths == ["/pulp/content/Default_Organization/Library/custom/Test_product/test2",
# "/pulp/content/Org/Library/custom/Test_product/test2/%3Fcomp%3Dmain%26rel%3Dstable"]
paths.each do |path|
if (prefix = prefixes.find { |pre| path.start_with?(pre) })
relative_paths << path.gsub(prefix, '')
# strip prefix and structured_apt postfix before adding to relative_paths
relative_paths << path.sub(prefix, '').sub(/\/?(%3F|\?).*/, '')
else
Rails.logger.warn("System #{self.host.name} (#{self.host.id}) requested binding to repo with unknown prefix. #{path}")
end
Expand Down

0 comments on commit d866593

Please sign in to comment.