From f916f5389aa7e7760e13011bd8fab8382908d58a Mon Sep 17 00:00:00 2001 From: Markus Bucher Date: Wed, 2 Oct 2024 16:44:11 +0200 Subject: [PATCH] WIP: Fix enabled_repos detection structured_apt adds postfix to repository-paths, which have to be stripped in order to be used for finding matching Katello::Repository --- app/models/katello/host/content_facet.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/katello/host/content_facet.rb b/app/models/katello/host/content_facet.rb index eeae0ddff16..1d627bfc2f2 100644 --- a/app/models/katello/host/content_facet.rb +++ b/app/models/katello/host/content_facet.rb @@ -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