summaryrefslogtreecommitdiffstats
path: root/release
diff options
context:
space:
mode:
authorgjb <gjb@FreeBSD.org>2017-05-14 10:15:04 +0000
committergjb <gjb@FreeBSD.org>2017-05-14 10:15:04 +0000
commitd0a85a93fdbb820cc060cc3b2664e1567983f203 (patch)
tree3f713eebe6f20f01851865fd57d05d09c0408464 /release
parentfcc659e5915f08d2fbe7b63c0d588812ea040c73 (diff)
downloadFreeBSD-src-d0a85a93fdbb820cc060cc3b2664e1567983f203.zip
FreeBSD-src-d0a85a93fdbb820cc060cc3b2664e1567983f203.tar.gz
MFC r318190:
Update release/scripts/atlas-upload.sh to account for API changes made recently by Atlas Hashicorp. The data returned from GET and POST requests has changed, which caused a number of regex patterns to fail to be properly identified as 'success' or 'failure', which ended up in upload/publish failures. Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'release')
-rwxr-xr-xrelease/scripts/atlas-upload.sh10
1 files changed, 5 insertions, 5 deletions
diff --git a/release/scripts/atlas-upload.sh b/release/scripts/atlas-upload.sh
index bf1dbf1..cf8b282 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
OpenPOWER on IntegriCloud