fix(fleet): handle empty setup response without aborting on pipefail

This commit is contained in:
MickLesk
2026-05-18 16:23:34 +02:00
parent 8722b73b7a
commit 997bd8984c

View File

@@ -78,7 +78,7 @@ done
SETUP_RESPONSE=$(curl -s -X POST "http://127.0.0.1:8080/api/latest/fleet/setup" \
-H "Content-Type: application/json" \
-d "{\"admin\":{\"admin\":true,\"email\":\"${FLEET_ADMIN_EMAIL}\",\"name\":\"Admin\",\"password\":\"${FLEET_ADMIN_PASS}\"},\"org_info\":{\"org_name\":\"Fleet\",\"org_logo_url\":\"\"},\"server_url\":\"http://127.0.0.1:8080\"}")
FLEET_TOKEN=$(echo "${SETUP_RESPONSE}" | grep -o '"token":"[^"]*"' | cut -d'"' -f4)
FLEET_TOKEN=$(echo "${SETUP_RESPONSE}" | grep -o '"token":"[^"]*"' | cut -d'"' -f4) || true
if [[ -n "${FLEET_TOKEN}" ]]; then
curl -s -X PATCH "http://127.0.0.1:8080/api/latest/fleet/config" \
-H "Content-Type: application/json" \