diff options
author | Glen Barber <gjb@FreeBSD.org> | 2017-05-11 16:37:29 +0000 |
---|---|---|
committer | Glen Barber <gjb@FreeBSD.org> | 2017-05-11 16:37:29 +0000 |
commit | 4d8276988e2f5d42d2c1f15104cb7825c9a6ad77 (patch) | |
tree | 05198baf7e1db5e5e55ed20212839e6380031d71 /release/scripts | |
parent | 7ac72c256fe486ebf36db886ad2d9a47a0fb6388 (diff) | |
download | src-4d8276988e2f5d42d2c1f15104cb7825c9a6ad77.tar.gz src-4d8276988e2f5d42d2c1f15104cb7825c9a6ad77.zip |
Notes
Diffstat (limited to 'release/scripts')
-rwxr-xr-x | release/scripts/atlas-upload.sh | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/release/scripts/atlas-upload.sh b/release/scripts/atlas-upload.sh index bf1dbf116dbc..cf8b282bd690 100755 --- a/release/scripts/atlas-upload.sh +++ b/release/scripts/atlas-upload.sh @@ -132,20 +132,20 @@ main () { echo "Failed to get the token from the API" exit 2; fi - echo ${TOKENRESULT} | grep "\"token\":" > /dev/null + echo ${TOKENRESULT} | grep -E "\"(token|upload_path)\":" > /dev/null if [ $? != 0 ]; then echo "No token found from the API" exit 2 else - TOKEN=$(echo $TOKENRESULT | sed -e 's/.*token":"//' -e 's/".*//') + TOKEN=$(echo $TOKENRESULT | sed -e 's/.*token":"//' -e 's/.*upload_path":"//' -e 's/}$//g' -e 's/"//g') echo "Uploading to Atlas" - UPLOADRESULT=$(/usr/local/bin/curl -s -X PUT --upload-file ${FILE} ${ATLAS_UPLOAD_URL}/${TOKEN}) + UPLOADRESULT=$(/usr/local/bin/curl -s -X PUT --upload-file ${FILE} ${TOKEN}) # Validate the Upload echo "Validating" VALIDRESULT=$(/usr/local/bin/curl -s "https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}/provider/${PROVIDER}?access_token=${KEY}") - HOSTED_TOKEN=$(echo $VALIDRESULT | sed -e 's/.*hosted_token":"//' -e 's/".*//') - if [ ! -z ${HOSTED_TOKEN} -a ! -z ${TOKEN} -a ${HOSTED_TOKEN} != ${TOKEN} ]; then + HOSTED_TOKEN=$(echo $VALIDRESULT | sed -e 's/.*"hosted"://' -e 's/,.*$//') + if [ ! -z ${TOKEN} -a "${HOSTED_TOKEN}" != "true" ]; then echo "Upload failed, try again." exit 2 fi |