If SSL cert is invalid we don't even reach the Nexus server. So add code
to check that status is 201 before proceeding.
Change-Id: Ic5c8a0ce4177f73e6f753001ee8bbc5fdf02956c
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
local resp
local status
- resp=$(curl -s -w "%{http_code}" --netrc -X POST -d "@$FILE_XML" \
+ resp=$(curl -s -w " %{http_code}" --netrc -X POST -d "@$FILE_XML" \
-H "Content-Type:application/xml" \
"${nexus_url}/service/local/staging/profiles/${staging_profile_id}/start")
status=$(echo "$resp" | awk 'END {print $NF}')
msg=$(sed -n -e 's/.*<msg>\(.*\)<\/msg>.*/\1/p' <<< $resp)
echo "ERROR: $msg"
exit "$status"
+ elif [ "$status" != "201" ]; then
+ echo "ERROR: Failed with status code $status"
+ exit "$status"
fi
local staging_repo_id