Configures horizon lbaas dashboard
fixes bug 1151865
Change-Id: I1f2c7f7f11170571fe37a9cf5444d26c1c8de959
diff --git a/lib/horizon b/lib/horizon
index 9180370..9c96b58 100644
--- a/lib/horizon
+++ b/lib/horizon
@@ -34,6 +34,24 @@
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 @@
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