Browse code

Configure Horizon to use SSL-enabled Keystone

SSL can be enabled in Keystone when devstack is executed.
Horizon was not being configured to use the SSL port so
authentication was failing.

Change-Id: I253766d359aaab0bd1f844a8a637adc77e8eee2b
Closes-Bug: 1293749

Rob Crittenden authored on 2014/03/17 13:07:52
Showing 1 changed files
... ...
@@ -45,7 +45,10 @@ function _horizon_config_set {
45 45
     local option=$3
46 46
     local value=$4
47 47
 
48
-    if grep -q "^$section" $file; then
48
+    if [ -z "$section" ]; then
49
+        sed -e "/^$option/d" -i $local_settings
50
+        echo -e "\n$option=$value" >> $file
51
+    elif grep -q "^$section" $file; then
49 52
         line=$(sed -ne "/^$section/,/^}/ { /^ *'$option':/ p; }" $file)
50 53
         if [ -n "$line" ]; then
51 54
             sed -i -e "/^$section/,/^}/ s/^\( *'$option'\) *:.*$/\1: $value,/" $file
... ...
@@ -103,6 +106,13 @@ function init_horizon {
103 103
         _horizon_config_set $local_settings OPENSTACK_NEUTRON_NETWORK enable_vpn True
104 104
     fi
105 105
 
106
+    _horizon_config_set $local_settings "" OPENSTACK_HOST \"${KEYSTONE_SERVICE_HOST}\"
107
+    _horizon_config_set $local_settings "" OPENSTACK_KEYSTONE_URL "\"${KEYSTONE_SERVICE_PROTOCOL}://%s:${KEYSTONE_SERVICE_PORT}/v2.0\" % OPENSTACK_HOST"
108
+
109
+    if [ -f $SSL_BUNDLE_FILE ]; then
110
+        _horizon_config_set $local_settings "" OPENSTACK_SSL_CACERT \"${SSL_BUNDLE_FILE}\"
111
+    fi
112
+
106 113
     # Create an empty directory that apache uses as docroot
107 114
     sudo mkdir -p $HORIZON_DIR/.blackhole
108 115