creationRoutesVM.sh: Handeling API token failure

This commit is contained in:
Alarig Le Lay 2020-11-01 15:18:31 +01:00
parent 700361c90d
commit d58edf68ab
Signed by: alarig
GPG key ID: 7AFE62C6DF8BCDEC

View file

@ -131,6 +131,11 @@ write_log DEBUG 'Connecting to API'
RES_AUTHENT=$(${CURL} -X POST --user ${USER_IPAM}:${PASSWORD_IPAM} ${URL}/user/)
CODE_RETOUR_RES_AUTHENT=$(echo ${RES_AUTHENT} | jq '.code')
if [ $? != 0 ]; then
# The IPAM is probably down, simulating 503 HTTP code
CODE_RETOUR_RES_AUTHENT=503
fi
# Si OK, on utilise l'IPAM, sinon on passe par le fichier de cache
if [ ${CODE_RETOUR_RES_AUTHENT} != 200 ]; then
write_log ERROR "Wrong HTTP code from the API: ${CODE_RETOUR_RES_AUTHENT}"