Bug #32036
closed"Failed to discover docker repositories because 'Content Default HTTP Proxy' is not used to connect to the registry."
Description
'Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1893617 \n\n*Description of problem:*\nThe Satellite that needs to connect to the RHSM/CDN via a HTTP Proxy failed to discover docker repositories (Web UI > Content -> Products -> Click Repo Discovery) because Satellite doesn\'t use the \'Content Default HTTP Proxy\' when connecting to the docker registry.\n\nHow to reproduce:\n1. In Satellite block outgoing port 443 to simulate no the no internet connection.\n\nfirewall-cmd --direct --add-rule ipv4 filter OUTPUT 1 -p tcp -m tcp --dport=443 -j REJECT\n\n2. Try to discover the registry.redhat.io in Web UI -> Content -> Products -> Click Repo Discovery. You should get connection refused error.\n3. Add a http proxy in Web UI -> Infrastructure -> Http Proxies -> New Http Proxy\n4. Set the added http proxy as Web UI -> Settings -> Content -> Default HTTP Proxy\n5. Again, try to discover the registry.redhat.io in Web UI -> Content -> Products -> Click Repo Discovery.\n\n*Actual results:*\nDiscovery failed. Error: Failed to open TCP connection to registry.redhat.io:443 (Connection refused - connect(2) for "registry.redhat.io" port 443)\n\n*Expected results:*\nDiscover successfully\n\n\n*Additional info:*\nHowever, it can connect successfully after setting the http proxy in Setting -> General -> HTTP proxy\n\n\nIn \'app/lib/katello/repo_discovery.rb\'\n-----------------------------------\n def docker_search\n params = {\n :accept => :json\n }\n params[:user] = @upstream_username unless @upstream_username.empty?\n params[:password] = @upstream_password unless @upstream_password.empty?\n begin\n results = RestClient.get(@uri.to_s + "v1/search?q=#{@search}", params) <====== ####\'default_global_content_proxy\' is not set here. If Setting[:http_proxy] is set then it will be used. ####\n\n JSON.parse(results)[\'results\'].each do |result|\n @found << result[\'name\']\n end\n rescue\n # Note: v2 endpoint does not support search\n results = RestClient.get(@uri.to_s + "v2/_catalog", params) <====== ####\'default_global_content_proxy\' is not set here. If Setting[:http_proxy] is set then it will be used. ####\n\n @found = JSON.parse(results)[\'repositories\']\n end\n @found.sort!\n end\n------------------------------------------'