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)