Skip to content

Commit

Permalink
try to use the fqdn for pulpcore urls
Browse files Browse the repository at this point in the history
Those URLs are used by Katello and clients to connect to Pulp and
`localhost` is almost never the right choice here as it will be either
not reachable (for clients) or have the wrong certs (for Katello).

Try to obtain the FQDN of the system from Facter, if available and fall
back to `Socket.gethostname` (which is not guaranteed to return a FQDN)
otherwise.
  • Loading branch information
evgeni committed Nov 13, 2024
1 parent fb79a61 commit 83e0df0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/smart_proxy_pulp_plugin/pulpcore_plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,20 @@

module PulpProxy
class PulpcorePlugin < ::Proxy::Plugin
fqdn = begin
require 'facter'
Facter.fact('networking.fqdn').value
rescue StandardError, LoadError
require 'socket'
Socket.gethostname
end

plugin "pulpcore", ::PulpProxy::VERSION
default_settings :pulp_url => 'https://localhost',
:content_app_url => 'https://localhost:24816/',
default_settings :pulp_url => "https://#{fqdn}",
:content_app_url => "https://#{fqdn}/pulp/content/",
:mirror => false,
:client_authentication => ['password', 'client_certificate'],
:rhsm_url => 'https://localhost/rhsm'
:rhsm_url => "https://#{fqdn}/rhsm"

AUTH_TYPES = ['password', 'client_certificate'].freeze

Expand Down

0 comments on commit 83e0df0

Please sign in to comment.