creationRoutesVM.sh: Handeling API token failure
This commit is contained in:
parent
700361c90d
commit
d58edf68ab
|
@ -131,6 +131,11 @@ write_log DEBUG 'Connecting to API'
|
||||||
RES_AUTHENT=$(${CURL} -X POST --user ${USER_IPAM}:${PASSWORD_IPAM} ${URL}/user/)
|
RES_AUTHENT=$(${CURL} -X POST --user ${USER_IPAM}:${PASSWORD_IPAM} ${URL}/user/)
|
||||||
CODE_RETOUR_RES_AUTHENT=$(echo ${RES_AUTHENT} | jq '.code')
|
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
|
# Si OK, on utilise l'IPAM, sinon on passe par le fichier de cache
|
||||||
if [ ${CODE_RETOUR_RES_AUTHENT} != 200 ]; then
|
if [ ${CODE_RETOUR_RES_AUTHENT} != 200 ]; then
|
||||||
write_log ERROR "Wrong HTTP code from the API: ${CODE_RETOUR_RES_AUTHENT}"
|
write_log ERROR "Wrong HTTP code from the API: ${CODE_RETOUR_RES_AUTHENT}"
|
||||||
|
|
Loading…
Reference in a new issue