Configures horizon lbaas dashboard

fixes bug 1151865

Change-Id: I1f2c7f7f11170571fe37a9cf5444d26c1c8de959
This commit is contained in:
Eugene Nikanorov 2013-03-07 16:10:10 +04:00
parent c3b658c8df
commit b663b33f51

View File

@ -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