From 72239bcb0ce1f15130ea478f9c0e96e7912581ac Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Fri, 1 Nov 2013 15:30:59 -0400 Subject: [PATCH] Extract fix_etc_hosts method Extract the work arounds for the /etc/hosts setup on HP cloud. Change-Id: I346f361b936b0cf1c09245f59efb61111f948b34 --- devstack-vm-gate-wrap.sh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/devstack-vm-gate-wrap.sh b/devstack-vm-gate-wrap.sh index d6ab5436..cbd9738d 100755 --- a/devstack-vm-gate-wrap.sh +++ b/devstack-vm-gate-wrap.sh @@ -39,6 +39,18 @@ function git_checkout { git clean -x -f -d -q } +function fix_etc_hosts { + # HPcloud stopped adding the hostname to /etc/hosts with their + # precise images. + + HOSTNAME=`/bin/hostname` + if ! grep $HOSTNAME /etc/hosts >/dev/null; then + echo "Need to add hostname to /etc/hosts" + sudo bash -c 'echo "127.0.1.1 $HOSTNAME" >>/etc/hosts' + fi + +} + function fix_disk_layout { # Hpcloud provides no swap, but does have a virtual disk mounted # at /mnt we can use. It also doesn't have enough space on / for @@ -63,15 +75,7 @@ function setup_workspace { # Enabled detailed logging, since output of this function is redirected set -o xtrace - # HPcloud stopped adding the hostname to /etc/hosts with their - # precise images. - - HOSTNAME=`/bin/hostname` - if ! grep $HOSTNAME /etc/hosts >/dev/null - then - echo "Need to add hostname to /etc/hosts" - sudo bash -c 'echo "127.0.1.1 $HOSTNAME" >>/etc/hosts' - fi + fix_etc_hosts fix_disk_layout