From b663b33f51f39a6912b0c01bbd9f8559c3e03418 Mon Sep 17 00:00:00 2001 From: Eugene Nikanorov Date: Thu, 7 Mar 2013 16:10:10 +0400 Subject: [PATCH] Configures horizon lbaas dashboard fixes bug 1151865 Change-Id: I1f2c7f7f11170571fe37a9cf5444d26c1c8de959 --- lib/horizon | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/horizon b/lib/horizon index 9180370b8d..9c96b58e6f 100644 --- a/lib/horizon +++ b/lib/horizon @@ -34,6 +34,24 @@ HORIZON_DIR=$DEST/horizon APACHE_USER=${APACHE_USER:-$USER} APACHE_GROUP=${APACHE_GROUP:-$(id -gn $APACHE_USER)} +# utility method of setting python option +function _horizon_config_set() { + local file=$1 + local section=$2 + local option=$3 + local value=$4 + + if grep -q "^$section" $file; then + line=$(sed -ne "/^$section/,/^}/ { /^ *'$option':/ p; }" $file) + if [ -n "$line" ]; then + sed -i -e "/^$section/,/^}/ s/^\( *'$option'\) *:.*$/\1: $value,/" $file + else + sed -i -e "/^$section/ a\n '$option': $value,\n" $file + fi + else + echo -e "\n\n$section = {\n '$option': $value,\n}" >> $file + fi +} # Entry Points # ------------ @@ -61,6 +79,11 @@ function init_horizon() { local_settings=$HORIZON_DIR/openstack_dashboard/local/local_settings.py cp $FILES/horizon_settings.py $local_settings + # enable loadbalancer dashboard in case service is enabled + if is_service_enabled q-lbaas; then + _horizon_config_set $local_settings OPENSTACK_QUANTUM_NETWORK enable_lb True + fi + # Initialize the horizon database (it stores sessions and notices shown to # users). The user system is external (keystone). cd $HORIZON_DIR