Fix the service toke and endpoint

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This commit is contained in:
Angus Salkeld 2012-03-30 15:36:26 +11:00
parent 682f1041c5
commit 93726e0567
1 changed files with 17 additions and 0 deletions

View File

@ -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