From 67b2919e0b92680a8ce3202c293506c0f8c67028 Mon Sep 17 00:00:00 2001 From: K Jonathan Harker Date: Fri, 30 May 2014 12:11:02 -0700 Subject: [PATCH] Add the new hostname to /etc/hosts in prepare_node It is good practice to update /etc/hosts with the new hostname when changing it. Some programs (such as sudo) will give warnings if it is unable to resolve its own name. Change-Id: I5c95c9cadc32d7d42c6c6546e136a80f4a7e02f4 --- .../openstack_project/files/nodepool/scripts/prepare_node.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/openstack_project/files/nodepool/scripts/prepare_node.sh b/modules/openstack_project/files/nodepool/scripts/prepare_node.sh index 2f9cab4e4a..3846dc9df8 100755 --- a/modules/openstack_project/files/nodepool/scripts/prepare_node.sh +++ b/modules/openstack_project/files/nodepool/scripts/prepare_node.sh @@ -31,6 +31,11 @@ forward-zone: EOF sudo hostname $HOSTNAME +if ! grep -q $HOSTNAME /etc/hosts +then + echo "127.0.1.1 $HOSTNAME" | sudo tee -a /etc/hosts +fi + # Fedora image doesn't come with wget if [ -f /usr/bin/yum ]; then sudo yum -y install wget