Updated Branches: refs/heads/trunk d1ebe0ce3 -> 7e027bbb4
WHIRR-634. Update private IP host file entry when required by AUTO_HOSTNAME_SUFFIX. Contributed by Graham Gear. Project: http://git-wip-us.apache.org/repos/asf/whirr/repo Commit: http://git-wip-us.apache.org/repos/asf/whirr/commit/7e027bbb Tree: http://git-wip-us.apache.org/repos/asf/whirr/tree/7e027bbb Diff: http://git-wip-us.apache.org/repos/asf/whirr/diff/7e027bbb Branch: refs/heads/trunk Commit: 7e027bbb453773b7c5bf1256051b7a70f32e3f0b Parents: d1ebe0c Author: Andrew Bayer <[email protected]> Authored: Mon Mar 11 10:57:12 2013 -0700 Committer: Andrew Bayer <[email protected]> Committed: Mon Mar 11 10:57:12 2013 -0700 ---------------------------------------------------------------------- CHANGES.txt | 3 +++ .../resources/functions/configure_hostnames.sh | 4 ++++ 2 files changed, 7 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/whirr/blob/7e027bbb/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 28c28fd..cb0fe01 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,6 +4,9 @@ Release 0.8.2 (unreleased changes) IMPROVEMENTS + WHIRR-634. Update private IP host file entry when required by + AUTO_HOSTNAME_SUFFIX. (Graham Gear via abayer) + WHIRR-660. Provide useful message if whirr.instance-templates is empty or not provided. (abayer) http://git-wip-us.apache.org/repos/asf/whirr/blob/7e027bbb/core/src/main/resources/functions/configure_hostnames.sh ---------------------------------------------------------------------- diff --git a/core/src/main/resources/functions/configure_hostnames.sh b/core/src/main/resources/functions/configure_hostnames.sh index 60709a0..07374c7 100644 --- a/core/src/main/resources/functions/configure_hostnames.sh +++ b/core/src/main/resources/functions/configure_hostnames.sh @@ -20,6 +20,7 @@ function configure_hostnames() { if [ ! -z $AUTO_HOSTNAME_SUFFIX ]; then PUBLIC_IP=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` + PRIVATE_IP=`/sbin/ifconfig eth1 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` HOSTNAME=${AUTO_HOSTNAME_PREFIX}`echo $PUBLIC_IP | tr . -`${AUTO_HOSTNAME_SUFFIX} if [ -f /etc/hostname ]; then echo $HOSTNAME > /etc/hostname @@ -28,6 +29,9 @@ function configure_hostnames() { sed -i -e "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/" /etc/sysconfig/network fi sed -i -e "s/$PUBLIC_IP.*/$PUBLIC_IP $HOSTNAME/" /etc/hosts + if [ ! -z $PRIVATE_IP ]; then + sed -i -e "s/$PRIVATE_IP.*/$PRIVATE_IP private.$HOSTNAME/" /etc/hosts + fi set +e if [ -f /etc/init.d/hostname ]; then /etc/init.d/hostname restart
