From owner-svn-src-stable-11@freebsd.org Sun May 14 10:15:06 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4EF8D69BD7; Sun, 14 May 2017 10:15:06 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C63889E; Sun, 14 May 2017 10:15:06 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v4EAF5jY065536; Sun, 14 May 2017 10:15:05 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4EAF59u065535; Sun, 14 May 2017 10:15:05 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201705141015.v4EAF59u065535@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Sun, 14 May 2017 10:15:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r318264 - in stable: 10/release/scripts 11/release/scripts X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 May 2017 10:15:06 -0000 Author: gjb Date: Sun May 14 10:15:04 2017 New Revision: 318264 URL: https://svnweb.freebsd.org/changeset/base/318264 Log: 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 Modified: stable/11/release/scripts/atlas-upload.sh Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/release/scripts/atlas-upload.sh Directory Properties: stable/10/ (props changed) Modified: stable/11/release/scripts/atlas-upload.sh ============================================================================== --- stable/11/release/scripts/atlas-upload.sh Sun May 14 09:07:13 2017 (r318263) +++ stable/11/release/scripts/atlas-upload.sh Sun May 14 10:15:04 2017 (r318264) @@ -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