Skip to content
Snippets Groups Projects

abort on http 5xx error

Files

+ 5
0
@@ -16,6 +16,7 @@
# ----------------------------------------------------------------------
# ah = axel.hahn@iml.unibe.ch
# 2022-02-16 v0.2 ah add --cfg param
# 2022-03-04 v0.3 ah abort on http 5xx error
# ======================================================================
tmpfile=/tmp/outcurl.tmp
@@ -365,6 +366,10 @@ typeset cfg_dryrun=false
if [ ${_paramDryrun} = false ]; then
_wd ">>>>> $_paramAction $_paramObj [${_object_name}] >> $_sMethod $_sUrl $_jsondata"
http.makeRequest "$_sMethod" "$_sUrl" "$_jsondata"
if http.isServerError >/dev/null; then
echo "CRITICAL ERROR: Director API request failed with a server error $_sMethod $_sUrl"
exit 1
fi
if [ $_bShowResponse = true ]; then
http.getResponseHeader
http.getResponse
Loading