Browse code

Merge "Use path-mounted keystone when running in httpd"

Jenkins authored on 2016/05/25 05:13:19
Showing 2 changed files
... ...
@@ -44,8 +44,8 @@ Alias /identity %KEYSTONE_BIN%/keystone-wsgi-public
44 44
     WSGIPassAuthorization On
45 45
 </Location>
46 46
 
47
-Alias /identity_admin %KEYSTONE_BIN%/keystone-wsgi-admin
48
-<Location /identity_admin>
47
+Alias /identity_v2_admin %KEYSTONE_BIN%/keystone-wsgi-admin
48
+<Location /identity_v2_admin>
49 49
     SetHandler wsgi-script
50 50
     Options +ExecCGI
51 51
 
... ...
@@ -122,8 +122,14 @@ if is_ssl_enabled_service "key" || is_service_enabled tls-proxy; then
122 122
 fi
123 123
 
124 124
 # complete URIs
125
-KEYSTONE_AUTH_URI=${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_AUTH_HOST}:${KEYSTONE_AUTH_PORT}
126
-KEYSTONE_SERVICE_URI=${KEYSTONE_SERVICE_PROTOCOL}://${KEYSTONE_SERVICE_HOST}:${KEYSTONE_SERVICE_PORT}
125
+if [ "$KEYSTONE_DEPLOY" == "mod_wsgi" ]; then
126
+    # If running in Apache, use path access rather than port.
127
+    KEYSTONE_AUTH_URI=${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_AUTH_HOST}/identity_v2_admin
128
+    KEYSTONE_SERVICE_URI=${KEYSTONE_SERVICE_PROTOCOL}://${KEYSTONE_SERVICE_HOST}/identity
129
+else
130
+    KEYSTONE_AUTH_URI=${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_AUTH_HOST}:${KEYSTONE_AUTH_PORT}
131
+    KEYSTONE_SERVICE_URI=${KEYSTONE_SERVICE_PROTOCOL}://${KEYSTONE_SERVICE_HOST}:${KEYSTONE_SERVICE_PORT}
132
+fi
127 133
 
128 134
 # V3 URIs
129 135
 KEYSTONE_AUTH_URI_V3=$KEYSTONE_AUTH_URI/v3
... ...
@@ -259,7 +265,15 @@ function configure_keystone {
259 259
         # Set the service ports for a proxy to take the originals
260 260
         service_port=$KEYSTONE_SERVICE_PORT_INT
261 261
         auth_port=$KEYSTONE_AUTH_PORT_INT
262
+    fi
262 263
 
264
+    # Override the endpoints advertised by keystone (the public_endpoint and
265
+    # admin_endpoint) so that clients use the correct endpoint. By default, the
266
+    # keystone server uses the public_port and admin_port which isn't going to
267
+    # work when you want to use a different port (in the case of proxy), or you
268
+    # don't want the port (in the case of putting keystone on a path in
269
+    # apache).
270
+    if is_service_enabled tls-proxy || [ "$KEYSTONE_DEPLOY" == "mod_wsgi" ]; then
263 271
         iniset $KEYSTONE_CONF DEFAULT public_endpoint $KEYSTONE_SERVICE_URI
264 272
         iniset $KEYSTONE_CONF DEFAULT admin_endpoint $KEYSTONE_AUTH_URI
265 273
     fi
... ...
@@ -582,7 +596,14 @@ function start_keystone {
582 582
     # Check that the keystone service is running. Even if the tls tunnel
583 583
     # should be enabled, make sure the internal port is checked using
584 584
     # unencryted traffic at this point.
585
-    if ! wait_for_service $SERVICE_TIMEOUT $auth_protocol://$KEYSTONE_SERVICE_HOST:$service_port/v$IDENTITY_API_VERSION/; then
585
+    # If running in Apache, use the path rather than port.
586
+
587
+    local service_uri=$auth_protocol://$KEYSTONE_SERVICE_HOST:$service_port/v$IDENTITY_API_VERSION/
588
+    if [ "$KEYSTONE_DEPLOY" == "mod_wsgi" ]; then
589
+        service_uri=$auth_protocol://$KEYSTONE_SERVICE_HOST/identity/v$IDENTITY_API_VERSION/
590
+    fi
591
+
592
+    if ! wait_for_service $SERVICE_TIMEOUT $service_uri; then
586 593
         die $LINENO "keystone did not start"
587 594
     fi
588 595
 
... ...
@@ -625,8 +646,8 @@ function bootstrap_keystone {
625 625
         --bootstrap-service-name keystone \
626 626
         --bootstrap-region-id "$REGION_NAME" \
627 627
         --bootstrap-admin-url "$KEYSTONE_AUTH_URI" \
628
-        --bootstrap-public-url "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT" \
629
-        --bootstrap-internal-url "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT"
628
+        --bootstrap-public-url "$KEYSTONE_SERVICE_URI" \
629
+        --bootstrap-internal-url "$KEYSTONE_SERVICE_URI"
630 630
 }
631 631
 
632 632
 # Restore xtrace