Description
Currently, configure_hostnames.sh ensures that the public IP host file entry is written if required by the AUTO_HOSTNAME_SUFFIX variable. It does not however touch the internal IP host file entry, which is likely to retain an entry for the initial (and generally unresolvable) hostname. It is suggested that configure_hostname.sh also update the private IP host file entry, with a 'private.' prefix to ensure there is no ambiguity in reverse lookups, since the order of the host file entries cannot be relied on (eg the order varies host to host, IP to IP on Rackspace Cloud). This keeps the public/private host file entries in sync and allows them to be used interchangably depending on the visibility requirements of the node.
Eg, on Rackspace cloud, if provisioning a node with a whirr.cluster-name 'cdh-cluster' on Rackspace Cloud UK, the pre configure_hostnames.sh on a particular node looks as so:
-bash-4.1$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.177.7.48 cdh-cluster-74f
31.222.177.80 cdh-cluster-74f
after current trunk configure_hostnames.sh:
-bash-4.1$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.177.7.48 cdh-cluster-74f
31.222.177.80 31-222-177-80.static.cloud-ips.co.uk
and after the suggested updates in this JIRA it would look like:
-bash-4.1$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.177.7.48 private.31-222-177-80.static.cloud-ips.co.uk
31.222.177.80 31-222-177-80.static.cloud-ips.co.uk