Browse code

Merge "Configures horizon lbaas dashboard"

Jenkins authored on 2013/03/15 07:04:55
Showing 1 changed files
... ...
@@ -34,6 +34,24 @@ HORIZON_DIR=$DEST/horizon
34 34
 APACHE_USER=${APACHE_USER:-$USER}
35 35
 APACHE_GROUP=${APACHE_GROUP:-$(id -gn $APACHE_USER)}
36 36
 
37
+# utility method of setting python option
38
+function _horizon_config_set() {
39
+    local file=$1
40
+    local section=$2
41
+    local option=$3
42
+    local value=$4
43
+
44
+    if grep -q "^$section" $file; then
45
+        line=$(sed -ne "/^$section/,/^}/ { /^ *'$option':/ p; }" $file)
46
+        if [ -n "$line" ]; then
47
+            sed -i -e "/^$section/,/^}/ s/^\( *'$option'\) *:.*$/\1: $value,/" $file
48
+        else
49
+            sed -i -e "/^$section/ a\n    '$option': $value,\n" $file
50
+        fi
51
+    else
52
+        echo -e "\n\n$section = {\n    '$option': $value,\n}" >> $file
53
+    fi
54
+}
37 55
 
38 56
 # Entry Points
39 57
 # ------------
... ...
@@ -61,6 +79,11 @@ function init_horizon() {
61 61
     local_settings=$HORIZON_DIR/openstack_dashboard/local/local_settings.py
62 62
     cp $FILES/horizon_settings.py $local_settings
63 63
 
64
+    # enable loadbalancer dashboard in case service is enabled
65
+    if is_service_enabled q-lbaas; then
66
+        _horizon_config_set $local_settings OPENSTACK_QUANTUM_NETWORK enable_lb True
67
+    fi
68
+
64 69
     # Initialize the horizon database (it stores sessions and notices shown to
65 70
     # users).  The user system is external (keystone).
66 71
     cd $HORIZON_DIR