diff --git a/labs/scripts/setup_lbaas_controller.sh b/labs/scripts/setup_lbaas_controller.sh index c0629c8a..4ebdbc90 100755 --- a/labs/scripts/setup_lbaas_controller.sh +++ b/labs/scripts/setup_lbaas_controller.sh @@ -36,6 +36,23 @@ function check_dashboard_settings { echo "Checking dashboard configuration." check_dashboard_settings +function check_apache_service { + # Check if apache service is down, if not force retry a couple of times. + sleep 10 + i=0 + until service apache2 status | grep 'not running'; do + sudo service apache2 stop + sleep 10 + i ++ + if [ $i -gt 3 ] + then + break + fi + done +} + echo "Reloading apache and memcached service." -sudo service apache2 restart +sudo service apache2 stop +check_apache_service +sudo service apache2 start sudo service memcached restart diff --git a/labs/scripts/ubuntu/apt_init.sh b/labs/scripts/ubuntu/apt_init.sh index 96605951..17861af8 100755 --- a/labs/scripts/ubuntu/apt_init.sh +++ b/labs/scripts/ubuntu/apt_init.sh @@ -50,9 +50,20 @@ function ubuntu_cloud_archive { -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" } +function apache_fix { + + # On '$service apache2 restart', apache will use a text browser to check + # connectivity on '127.0.0.1' or 'localhost'. Apache needs www-browser + # (/etc/alternatives/www-browser) virtual package to carry out this check. + # Include a basic text browser to preemptively avoid this error. + sudo apt-get -y install w3m + +} + # precise needs the cloud archive, and so does trusty for non-Icehouse releases if grep -qs DISTRIB_CODENAME=precise /etc/lsb-release || [ "$OPENSTACK_RELEASE" != "icehouse" ]; then echo "Enabling the Ubuntu cloud archive." ubuntu_cloud_archive + apache_fix fi diff --git a/labs/scripts/ubuntu/setup_horizon.sh b/labs/scripts/ubuntu/setup_horizon.sh index 2ba1cfe8..ffc1c37e 100755 --- a/labs/scripts/ubuntu/setup_horizon.sh +++ b/labs/scripts/ubuntu/setup_horizon.sh @@ -53,6 +53,22 @@ function check_dashboard_settings { echo "Checking dashboard configuration." check_dashboard_settings +function check_apache_service { + # Check if apache service is down, if not force retry a couple of times. + sleep 10 + i=0 + until service apache2 status | grep 'not running'; do + sudo service apache2 stop + sleep 10 + i ++ + if [ $i -gt 3] + then + break + fi + done +} + echo "Reloading apache and memcached service." -sudo service apache2 restart +sudo service apache2 stop +check_apache_service sudo service memcached restart