summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrabi <ramishra@redhat.com>2017-08-01 12:02:50 +0530
committerrabi <ramishra@redhat.com>2017-08-01 14:42:43 +0530
commita276f088cebc7f28b85841dab39a939a6500690d (patch)
tree826532ca73965138aff88032664a03cf48010911
parentcedf2769181954dfb6ec5ebfefdc1d105b8ec266 (diff)
downloadheat-templates-a276f088cebc7f28b85841dab39a939a6500690d.tar.gz
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
-rwxr-xr-xhot/software-config/example-templates/cirros-example/init.d/heat-deploy-hook18
1 files 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 e063e09..daa592f 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)