Closed joelmoss closed 9 years ago
Also, as an aside, why is the hostname added to the hosts file?
https://github.com/xhost-cookbooks/system/issues/17 is slightly related although that edge case was for localhost. I currently don't set unique on the fqdn hostfile entry with the system cookbook so I assume it would suffer from the same fail in this use case?
Yeah, I don't think this is related, as it is not localhost in use here. But if you don't specify it as unique, this is still broken. Any alternative solutions?
@joelmoss happy to field a PR from you with the system cookbook (https://github.com/xhost-cookbooks/system).
Why would I do that? This cookbook does not use the system cookbook.
@joelmoss because you asked for an alternative solution. Sorry if my context scope was too wide there sir.
Sorry, still confoozed :(
I don't want to use the system cookbook, as it does a more than I need/want. But I do use this cookbook. That is where I fail to see the relevance of the system cookbook.
Nobody has to ever use 'the whole of a cookbook' if that cookbook is designed well. That is why recipes and LWRPs exist.
The relevance is that the system cookbook implements the change of /etc/hosts via the hostsfile cookbook (it depends on it) in essentially the same way, thus my original comment.
You can set the hostname with either cookbook. There is no reason why we can't learn from each other here - its the reason why I follow this cookbook.
:+1: wfm
So in https://github.com/3ofcoins/chef-cookbook-hostname/blob/develop/recipes/default.rb#L106-L112 the hosts file entry is created for the hostname, however the
unique
parameter is not specified, so if the IP of the host has changed, a duplicate entry will be added for the hostname, resulting in all sorts of nasty funkiness.This PR adds the
unique
param.