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

Allow the possibility to generate fqdn friendly /etc/hosts files. #109

Closed

Conversation

purpleidea
Copy link

This is needed on some systems so that:

hostname --fqdn

and

facter -p | grep fqdn

both return something useful.

This patch adds the fqdn_friendly and domain_name configuration options.

@purpleidea
Copy link
Author

I needed this patch to make things work with FQDN's properly. Other than that, great vagrant plugin, thanks!

@purpleidea
Copy link
Author

Wait, don't merge yet, a small (insignificant) bug exists.

@purpleidea
Copy link
Author

Okay, all fixed now, small silly issue. Good to go!

purpleidea added a commit to purpleidea/puppet-ipa that referenced this pull request Jul 25, 2014
@pbitty
Copy link
Contributor

pbitty commented Aug 26, 2014

Hi @purpleidea, thanks for contributing. Sorry it took me so long to reply. I will be looking at these PRs tonight and I'll get back to you as soon as I can.

@pbitty
Copy link
Contributor

pbitty commented Aug 27, 2014

I think having the ability to make /etc/hosts fqdn-friendly is great, and the PR definitely accomplishes this. However, I have a couple of concerns that I want to look over before we merge this in.

Adjusting localhost line

As it stands in the PR, we'll be forcing the format of this line to be the one hardcoded in the source code. From what I understand, the goal is to remove the machine's hostname from that line so that it won't conflict with the FQDN line we are adding, right?

If so, then maybe we should only go for removing the hostname from that line, leaving the rest of it intact.

So if the line says:
127.0.0.1 foo localhost
it will become
127.0.0.1 foo

I'm happy to work out something based on regular expressions. Perhaps we should also make this an an opt-in feature. Something like config.remove_conflicts?

Also, we should only be adjusting the localhost lines on the guests and not on the hosts. With config.manage_host enabled, this PR will to do this on the host machine as well. Although this will likely not change anything on the host in most cases, I'd rather keep changes to the hosts file on the host limited to just the vagrant-hostmanager block.

Config options

Would it be enough to just have the config.hostmanager.domain_name option? If that value is set, we include the FQDN in the hosts file. Otherwise, we just leave it.

Aliases

We recently made aliases render individually on separate lines (#60 and PR #103), due to issues with long alias lines on some OSes. In hind-sight, I this should be an opt-in feature. This way, both the FQDN feature and the 'separate aliases' feature should be able to co-exist.

ie: if both separate_aliases and domain_name are enabled, the FQDN will still render, and aliases will still go on separate lines. Currently in the PR, it's one or the other.

Thoughts?

This is needed on some systems so that:

hostname --fqdn

and

facter -p | grep fqdn

both return something useful.

This patch adds the fqdn_friendly and domain_name configuration options.
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.

None yet

2 participants