From 4a9ff0a501366bd6e351115f1bea7ae3c1b23d5a Mon Sep 17 00:00:00 2001 From: Roger Luethi Date: Sat, 29 Nov 2014 14:37:21 +0100 Subject: [PATCH] labs: check settings in setup_horizon.sh Check and document configuration settings for horizon. Change-Id: I6ba7981c699c64e58feecd97017f2b1072da95c2 --- labs/scripts/setup_horizon.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/labs/scripts/setup_horizon.sh b/labs/scripts/setup_horizon.sh index 191abb37..c7d13aab 100755 --- a/labs/scripts/setup_horizon.sh +++ b/labs/scripts/setup_horizon.sh @@ -19,6 +19,36 @@ sudo apt-get install -y apache2 memcached libapache2-mod-wsgi \ echo "Purging Ubuntu theme." sudo dpkg --purge openstack-dashboard-ubuntu-theme +function check_dashboard_settings { + local memcached_conf=/etc/memcached.conf + local dashboard_conf=/etc/openstack-dashboard/local_settings.py + + # Port is a number on line starting with "-p " + local port=$(grep -Po -- '(?<=^-p )\d+' $memcached_conf) + + # Interface is an IP address on line starting with "-l " + local interface=$(grep -Po -- '(?<=^-l )[\d\.]+' $memcached_conf) + + echo "memcached listening on $interface:$port." + + # Line should read something like: 'LOCATION' : '127.0.0.1:11211', + if grep "LOCATION.*$interface:$port" $dashboard_conf; then + echo "$dashboard_conf agrees." + else + echo >&2 "$dashboard_conf disagrees. Aborting." + exit 1 + fi + + echo -n "Time zone setting: " + grep TIME_ZONE $dashboard_conf + + echo -n "Allowed hosts: " + grep "^ALLOWED_HOSTS" $dashboard_conf +} + +echo "Checking dashboard configuration." +check_dashboard_settings + echo "Reloading apache and memcached service." sudo service apache2 restart sudo service memcached restart