puppetlabs/Razor — pull request #134 by tjmcs (2012-07-11 21:10:43+00:00)
Title: Changes to add hostname and domainname set by model to /etc/hosts file

This pull request includes the changes needed to add a line to the /etc/hosts file containing the local hostname and fully-qualified domain name (so that these names will resolve properly). The complete list of changes is as follows:
1. A new parameter was added to the list of parameters requested when setting up a new Ubuntu, Debian, or Redhat models (the domainname). That parameter is required, with a default value of "localdomain"
2. The existing models were cleaned up a bit to remove duplicated methods and initialization code from the sub-classes of the various models (some models re-executed the same code in the subclass initialize method that was already being executed in the super's initialize method, which was being called from the initialize method of the subclass; some sub-classes also declared the same methods as their super-class, even though there was no change in behavior).
3. A new pair of 'sed' statements were added to the 'os_boot.erb' files for these models that add the "hostname.localdomain" and "hostname" names to the /etc/hosts line for the non-loopback local IP address.

The changes in this pull request have been tested under Ubuntu 11.10 (and should work without issues under Ubuntu 12.04). Additional testing under Debian and Redhat/CentOS should be performed to ensure that the 'sed' commands added to the corresponding "os_boot.erb" files work on those platforms as well...