Skip to content

Commit

Permalink
Fixes #34070 - fix container registry with azure plugin
Browse files Browse the repository at this point in the history
a previous fix switched to using filenames for certs
if the Faraday default adapter was set to :excon,
however this broke the container registry proxy, as its
using rest_client, but is still using this same piece of code
  • Loading branch information
jlsherrill committed Dec 3, 2021
1 parent 31d422d commit d6adef8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/lib/katello/resources/registry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def load_class
self.prefix = "/pulpcore_registry/"
self.site = "#{uri.scheme}://#{uri.host}:#{uri.port}"
self.ca_cert_file = Setting[:ssl_ca_file]
pulp_primary.pulp3_ssl_configuration(self)
pulp_primary.pulp3_ssl_configuration(self, :net_http)

self
end
Expand Down
8 changes: 4 additions & 4 deletions app/models/katello/concerns/smart_proxy_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,17 +185,17 @@ def pulp3_configuration(config_class)
end
end

def pulp3_ssl_configuration(config)
def pulp3_ssl_configuration(config, connection_adapter = Faraday.default_adapter)
legacy_pulp_cert = !self.setting(PULP3_FEATURE, 'client_authentication')&.include?('client_certificate')

if Faraday.default_adapter == :excon
if connection_adapter == :excon
config.ssl_client_cert = ::Cert::Certs.ssl_client_cert_filename(use_admin_as_cn_cert: legacy_pulp_cert)
config.ssl_client_key = ::Cert::Certs.ssl_client_key_filename(use_admin_as_cn_cert: legacy_pulp_cert)
elsif Faraday.default_adapter == :net_http
elsif connection_adapter == :net_http
config.ssl_client_cert = ::Cert::Certs.ssl_client_cert(use_admin_as_cn_cert: legacy_pulp_cert)
config.ssl_client_key = ::Cert::Certs.ssl_client_key(use_admin_as_cn_cert: legacy_pulp_cert)
else
fail "Unexpected faraday default_adapter #{Faraday.default_adapter}! Cannot continue, this is likely a bug."
fail "Unexpected connection_adapter #{Faraday.default_adapter}! Cannot continue, this is likely a bug."
end
end

Expand Down

0 comments on commit d6adef8

Please sign in to comment.