From a276f088cebc7f28b85841dab39a939a6500690d Mon Sep 17 00:00:00 2001 From: rabi Date: Tue, 1 Aug 2017 12:02:50 +0530 Subject: [PATCH] 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 --- .../cirros-example/init.d/heat-deploy-hook | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hot/software-config/example-templates/cirros-example/init.d/heat-deploy-hook b/hot/software-config/example-templates/cirros-example/init.d/heat-deploy-hook index e063e09a..daa592ff 100755 --- a/hot/software-config/example-templates/cirros-example/init.d/heat-deploy-hook +++ b/hot/software-config/example-templates/cirros-example/init.d/heat-deploy-hook @@ -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)