Skip to content

Commit

Permalink
Fixes #35627 - Registration - Find proxy by certificate
Browse files Browse the repository at this point in the history
  • Loading branch information
stejskalleos committed Oct 26, 2022
1 parent 942cdda commit 648ed7f
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Katello
module Concerns
module Api::V2::RegistrationControllerExtensions
extend ActiveSupport::Concern
include ::Foreman::Controller::SmartProxyAuth

def prepare_host
if params['uuid']
Expand Down Expand Up @@ -35,14 +36,19 @@ def context_urls

def smart_proxy
@smart_proxy ||= begin
proxy = params[:url] ? SmartProxy.unscoped.find_by(url: params[:url]) : SmartProxy.pulp_primary
proxy = params[:url] ? find_smart_proxy : SmartProxy.pulp_primary

fail Foreman::Exception, _('Smart proxy content source not found!') unless proxy
fail Foreman::Exception, _('Pulp 3 is not enabled on Smart proxy!') unless proxy.pulp3_enabled?

proxy
end
end

def find_smart_proxy
auth_smart_proxy
@detected_proxy
end
end
end
end

0 comments on commit 648ed7f

Please sign in to comment.