Make cirros-example v3 compatible

This example seems broken. Though it will work if you
change the auth_url to point to /v2.0 rather than /v3, it's
better to make it work with v3 (the default now for all
keystone deployments).

Change-Id: I411a0f50ae50ee5b7c2564a7764ee9a01b00afea
This commit is contained in:
rabi 2017-08-01 12:02:50 +05:30
parent cedf276918
commit a276f088ce
1 changed files with 9 additions and 9 deletions

View File

@ -16,18 +16,18 @@ USER_ID=$(cat $OSC_DATA_PATH/user_id)
AUTH_URL=$(cat $OSC_DATA_PATH/auth_url)
PROJECT_ID=$(cat $OSC_DATA_PATH/project_id)
# Get a token and de-jsonify the response
# FIXME currently this only works with v2 keystone
V2_JSON='{"auth": {"tenantId": "'$PROJECT_ID'", "passwordCredentials": {"userId": "'$USER_ID'", "password": "'$PASSWORD'"}}}'
curl -i -d "$V2_JSON" -H "Content-type: application/json" $AUTH_URL/tokens | grep "^{" > ${TMPDIR}/token_json.json
# Get a token and de-jsonify the response, only supports keystone v3
V3_JSON='{"auth": {"identity": {"methods": ["password"], "password": {"user": {"id": "'$USER_ID'", "password": "'$PASSWORD'"}}}, "scope": {"project": {"id": "'$PROJECT_ID'"}}}}'
curl -i -d "$V3_JSON" -H "Content-type: application/json" $AUTH_URL/auth/tokens > ${TMPDIR}/token.json
TOKEN=$(grep 'X-Subject-Token' ${TMPDIR}/token.json | awk '{print $2}')
mkdir -p ${TMPDIR}/token_data_out
json2fstree ${TMPDIR}/token_data_out ${TMPDIR}/token_json.json
TOKEN=$(cat ${TMPDIR}/token_data_out/access/token/id)
grep "^{" ${TMPDIR}/token.json > ${TMPDIR}/token_body.json
json2fstree ${TMPDIR}/token_data_out ${TMPDIR}/token_body.json
# Locate the heat API endpoint from the token response
SC_DIR=$(grep -r orchestration ${TMPDIR}/token_data_out/access/serviceCatalog/ | sed "s/\/type:orchestration//")
SC_PUBURL=$(find $SC_DIR -name publicURL)
SC_ENDPOINT=$(cat $SC_PUBURL)
SC_DIR=$(grep -r orchestration ${TMPDIR}/token_data_out/token/catalog | sed "s/\/type:orchestration//")
SC_PUBURL=$(grep -r public ${SC_DIR} | sed "s/\/interface:public//")
SC_ENDPOINT=$(cat ${SC_PUBURL}/url)
# Get resource metadata and decode it with json2fstree
STACK_ID=$(cat $OSC_DATA_PATH/stack_id)