Browse Source

creationRoutesVM.sh: Handeling API token failure

master
Alarig Le Lay 2 years ago
parent
commit
d58edf68ab
Signed by: alarig
GPG Key ID: 7AFE62C6DF8BCDEC
  1. 5
      creationRoutesVM.sh

5
creationRoutesVM.sh

@ -131,6 +131,11 @@ write_log DEBUG 'Connecting to API' @@ -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}"

Loading…
Cancel
Save