You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whirr.apache.org by ab...@apache.org on 2013/03/25 17:12:40 UTC

[2/5] git commit: WHIRR-634. Update private IP host file entry when required by AUTO_HOSTNAME_SUFFIX. Contributed by Graham Gear.

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/13b76ae7
Tree: http://git-wip-us.apache.org/repos/asf/whirr/tree/13b76ae7
Diff: http://git-wip-us.apache.org/repos/asf/whirr/diff/13b76ae7

Branch: refs/heads/branch-0.8
Commit: 13b76ae7cd429732774c926ffcc248fd83ca0054
Parents: ff134d2
Author: Andrew Bayer <an...@gmail.com>
Authored: Mon Mar 11 10:57:12 2013 -0700
Committer: Andrew Bayer <an...@gmail.com>
Committed: Mon Mar 25 09:12:13 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/13b76ae7/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/13b76ae7/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