Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try to use the fqdn for pulpcore urls #43

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

try to use the fqdn for pulpcore urls #43

wants to merge 1 commit into from

Conversation

evgeni
Copy link
Member

@evgeni evgeni commented Nov 13, 2024

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.

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.
fqdn = begin
require 'facter'
Facter.fact('networking.fqdn').value
rescue StandardError, LoadError
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL that LoadError is not a StandardError

@ekohl
Copy link
Member

ekohl commented Nov 18, 2024

These defaults are sort of development values. and I always assumed people would set this explicitly because I don't trust autodetection.

@ehelms
Copy link
Member

ehelms commented Nov 18, 2024

These defaults are sort of development values. and I always assumed people would set this explicitly because I don't trust autodetection.

I think the only way to enforce that is to not have a default value and ensure users think about / set this value. I would tend to prefer no default value other than a default specified in the settings file.

@ekohl
Copy link
Member

ekohl commented Nov 18, 2024

If there is no sane default, don't have one in the first place. That makes a lot of sense to me.

@evgeni
Copy link
Member Author

evgeni commented Nov 18, 2024

I guess the sanity is debatable, yeah.

Would y'all prefer if I'd just drop the localhost default values, and mark the settings as required?

@ekohl
Copy link
Member

ekohl commented Nov 18, 2024

Works for me. Saves doing these lookups regardless of whether a setting is configured (which can fail or slow things down)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants