]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Fix the service toke and endpoint
authorAngus Salkeld <asalkeld@redhat.com>
Fri, 30 Mar 2012 04:36:26 +0000 (15:36 +1100)
committerAngus Salkeld <asalkeld@redhat.com>
Fri, 30 Mar 2012 04:36:26 +0000 (15:36 +1100)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
tools/heat-keystone-service

index 56b9f7d8e57dd62e83aaf525cd0202e61d63b0a1..5b869c9c29bb85882ec954a073f25da4415a92c4 100755 (executable)
@@ -6,6 +6,22 @@ function get_id () {
     echo `"$@" | grep ' id ' | awk '{print $4}'`
 }
 
+KEYSTONE_CONF=${KEYSTONE_CONF:-/etc/keystone/keystone.conf}
+
+# Extract some info from Keystone's configuration file
+if [[ -r "$KEYSTONE_CONF" ]]; then
+    CONFIG_SERVICE_TOKEN=$(sed 's/[[:space:]]//g' $KEYSTONE_CONF | grep ^admin_token= | cut -d'=' -f2)
+    CONFIG_ADMIN_PORT=$(sed 's/[[:space:]]//g' $KEYSTONE_CONF | grep ^admin_port= | cut -d'=' -f2)
+fi
+
+export SERVICE_TOKEN=${SERVICE_TOKEN:-$CONFIG_SERVICE_TOKEN}
+export SERVICE_ENDPOINT=${SERVICE_ENDPOINT:-http://127.0.0.1:${CONFIG_ADMIN_PORT:-35357}/v2.0}
+if [[ -z "$SERVICE_TOKEN" ]]; then
+    echo "No service token found."
+    echo "Set SERVICE_TOKEN manually from keystone.conf admin_token."
+    exit 1
+fi
+
 ADMIN_ROLE=$(keystone user-list | grep True | cut -d\| -f2,5 | grep admin | cut -d\| -f1)
 SERVICE_TENANT=$(keystone tenant-list | grep service | cut -d\| -f2)
 SERVICE_PASSWORD=${SERVICE_PASSWORD:-$OS_PASSWORD}
@@ -17,6 +33,7 @@ fi
 echo ADMIN_ROLE $ADMIN_ROLE
 echo SERVICE_TENANT $SERVICE_TENANT
 echo SERVICE_PASSWORD $SERVICE_PASSWORD
+echo SERVICE_TOKEN $SERVICE_TOKEN
 
 
 # Services