]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Use hostname from env in heat-keystone-setup
authorStephen Sugden <me@stephensugden.com>
Mon, 13 May 2013 21:17:31 +0000 (14:17 -0700)
committerStephen Sugden <me@stephensugden.com>
Mon, 13 May 2013 21:25:16 +0000 (14:25 -0700)
Prints a warning if the endpoints are going to be registered as localhost URIs.

Change-Id: I32efcf826f400ca2763cb5758dce02ffdbdb9ae1

bin/heat-keystone-setup

index 9252d3e6b37fdd69cc4930e81a6d9b3a35fd4fbc..ca18450133591ce6fe0a34bcdb7c52461d32b851 100755 (executable)
@@ -200,14 +200,22 @@ keystone_setup() {
     ADMIN_ROLE=$(get_data 2 admin 1 keystone role-list)
     SERVICE_TENANT=$(get_data 2 service 1 keystone tenant-list)
     SERVICE_PASSWORD=${SERVICE_PASSWORD:-$OS_PASSWORD}
+    SERVICE_HOST=${SERVICE_HOST:-localhost}
+
     if [[ "$SERVICE_PASSWORD" == "$OS_PASSWORD" ]]; then
         echo "Using the OS_PASSWORD for the SERVICE_PASSWORD." >&2
     fi
 
+    if [[ "$SERVICE_HOST" == "localhost" ]]; then
+        echo "Endpoints will be registered as localhost, but this usually won't work."
+        echo  "Set SERVICE_HOST to a publically accessible hostname/IP instead."
+    fi
+
     echo ADMIN_ROLE $ADMIN_ROLE
     echo SERVICE_TENANT $SERVICE_TENANT
     echo SERVICE_PASSWORD $SERVICE_PASSWORD
     echo SERVICE_TOKEN $SERVICE_TOKEN
+    echo SERVICE_HOST $SERVICE_HOST
 
     HEAT_USERNAME="heat"
     HEAT_USERID=$(get_user $HEAT_USERNAME)
@@ -223,11 +231,11 @@ keystone_setup() {
 
     HEAT_CFN_SERVICE=$(get_service heat-cfn cloudformation \
                        "Heat CloudFormation API")
-    add_endpoint $HEAT_CFN_SERVICE 'http://localhost:8000/v1'
+    add_endpoint $HEAT_CFN_SERVICE "http://$SERVICE_HOST:8000/v1"
 
     HEAT_OS_SERVICE=$(get_service heat orchestration \
                       "Heat API")
-    add_endpoint $HEAT_OS_SERVICE 'http://localhost:8004/v1/%(tenant_id)s'
+    add_endpoint $HEAT_OS_SERVICE "http://$SERVICE_HOST:8004/v1/%(tenant_id)s"
 }
 
 if [[ ${BASH_SOURCE[0]} == ${0} ]]; then