From 0fdf8b3c0362459034457b86b4d54679bcf12a00 Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Wed, 6 Nov 2024 08:09:51 +0100 Subject: [PATCH] - Handles curl fail in provision - creates flag file in case of ogadmin user --- provision_ogcore.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/provision_ogcore.sh b/provision_ogcore.sh index d693399..1ccfcf4 100644 --- a/provision_ogcore.sh +++ b/provision_ogcore.sh @@ -36,12 +36,13 @@ bearer=$(curl -k -X 'POST' 'https://localhost:8443/auth/login' -H 'accept: a if [ $adminuser == "ogadmin" ]; then echo "Cambiando password a ogadmin no puede ser el usuario administrador" - ogadmin_uuid=$(curl -q -k -L https://localhost:8443/users/?username=ogadmin -H 'accept: application/json' -H "Authorization: Bearer $bearer" | jq .[0].uuid | sed 's/"//g') - curl -k -L -X PUT "https://localhost:8443/users/$ogadmin_uuid/reset-password" -H 'accept: application/ld+json' -H 'Content-Type: application/ld+json' -d "{\"currentPassword\": \"12345678\", \"newPassword\": \"$adminpass\", \"repeatNewPassword\": \"$adminpass\"}" -H "Authorization: Bearer $bearer" + ogadmin_uuid=$(curl -f -q -k -L https://localhost:8443/users/?username=ogadmin -H 'accept: application/json' -H "Authorization: Bearer $bearer" | jq .[0].uuid | sed 's/"//g') + curl -f -k -L -X PUT "https://localhost:8443/users/$ogadmin_uuid/reset-password" -H 'accept: application/ld+json' -H 'Content-Type: application/ld+json' -d "{\"currentPassword\": \"12345678\", \"newPassword\": \"$adminpass\", \"repeatNewPassword\": \"$adminpass\"}" -H "Authorization: Bearer $bearer" + touch /opt/opengnsys/ogCore/installer/.deployed exit 0 fi -curl -k -L --location 'https://localhost:8443/users' \ +curl -k -L -f --location 'https://localhost:8443/users' \ --header 'Content-Type: application/json' \ --header "Authorization: Bearer $bearer" \ --data "{ \"username\": \"$adminuser\", \"password\": \"$adminpass\", \"roles\": [\"ROLE_SUPER_ADMIN\"] }"