summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-08-23 07:45:21 +0000
committerGerrit Code Review <review@openstack.org>2017-08-23 07:45:21 +0000
commit671de9b5372c006554358c2439009a7914469989 (patch)
treeee22fc3753b09fb5a20e97dff6cfa8ddc5108f82
parenta7243bc0896a24e0d403589b852ba51ecb4ff2a0 (diff)
parenta276f088cebc7f28b85841dab39a939a6500690d (diff)
downloadheat-templates-671de9b5372c006554358c2439009a7914469989.tar.gz
Merge "Make cirros-example v3 compatible"
-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)