Author: abayer
Date: Tue Aug 21 13:32:16 2012
New Revision: 1375537
URL: http://svn.apache.org/viewvc?rev=1375537&view=rev
Log:
WHIRR-635. Ensure hostname update as required by AUTO_HOSTNAME_SUFFIX is
consistent for RHEL derivatives. Contributed by Graham Gear
Modified:
whirr/trunk/CHANGES.txt
whirr/trunk/core/src/main/resources/functions/configure_hostnames.sh
Modified: whirr/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/whirr/trunk/CHANGES.txt?rev=1375537&r1=1375536&r2=1375537&view=diff
==============================================================================
--- whirr/trunk/CHANGES.txt (original)
+++ whirr/trunk/CHANGES.txt Tue Aug 21 13:32:16 2012
@@ -123,6 +123,10 @@ Release 0.8.0 - 2012-08-17
BUG FIXES
+ WHIRR-635. Ensure hostname update as required by
+ AUTO_HOSTNAME_SUFFIX is consistent for RHEL derivatives (Graham
+ Gear via abayer)
+
WHIRR-640. Ensure minRam is set for CDH recipes and test
properties. (abayer)
Modified: whirr/trunk/core/src/main/resources/functions/configure_hostnames.sh
URL:
http://svn.apache.org/viewvc/whirr/trunk/core/src/main/resources/functions/configure_hostnames.sh?rev=1375537&r1=1375536&r2=1375537&view=diff
==============================================================================
--- whirr/trunk/core/src/main/resources/functions/configure_hostnames.sh
(original)
+++ whirr/trunk/core/src/main/resources/functions/configure_hostnames.sh Tue
Aug 21 13:32:16 2012
@@ -21,7 +21,12 @@ function configure_hostnames() {
if [ ! -z $AUTO_HOSTNAME_SUFFIX ]; then
PUBLIC_IP=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk
'{ print $1}'`
HOSTNAME=${AUTO_HOSTNAME_PREFIX}`echo $PUBLIC_IP | tr .
-`${AUTO_HOSTNAME_SUFFIX}
- echo $HOSTNAME > /etc/hostname
+ if [ -f /etc/hostname ]; then
+ echo $HOSTNAME > /etc/hostname
+ fi
+ if [ -f /etc/sysconfig/network ]; then
+ sed -i -e "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/" /etc/sysconfig/network
+ fi
sed -i -e "s/$PUBLIC_IP.*/$PUBLIC_IP $HOSTNAME/" /etc/hosts
set +e
if [ -f /etc/init.d/hostname ]; then