Skip to content

Commit

Permalink
remove jq pieces
Browse files Browse the repository at this point in the history
  • Loading branch information
morga471 committed Apr 28, 2025
1 parent 66a3e2f commit e7c74fa
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions config_job.tf
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ GRANT
# Check if user exists
local user_id=$(curl -s \
-H "Authorization: Bearer $KC_TOKEN" \
"$KC_URL/auth/admin/realms/$realm/users?username=$username" | jq -r '.[0].id')
"$KC_URL/auth/admin/realms/$realm/users?username=$username")
if [ "$user_id" != "null" ] && [ -n "$user_id" ]; then
echo "User $username already exists with ID $user_id"
Expand All @@ -138,7 +138,7 @@ GRANT
# Get user ID
user_id=$(curl -s \
-H "Authorization: Bearer $KC_TOKEN" \
"$KC_URL/auth/admin/realms/$realm/users?username=$username" | jq -r '.[0].id')
"$KC_URL/auth/admin/realms/$realm/users?username=$username")
# Set password
curl -s -X PUT \
Expand Down Expand Up @@ -189,7 +189,7 @@ GRANT
# Get user ID
local user_id=$(curl -s \
-H "Authorization: Bearer $KC_TOKEN" \
"$KC_URL/auth/admin/realms/$realm/users?username=$username" | jq -r '.[0].id')
"$KC_URL/auth/admin/realms/$realm/users?username=$username")
# Get role
local role=$(curl -s \
Expand Down Expand Up @@ -224,11 +224,6 @@ GRANT
-H "Authorization: Bearer $KC_TOKEN" \
"$KC_URL/auth/admin/realms/$realm/clients?clientId=$client_id")
if [ "$(echo $clients | jq -r '. | length')" -gt 0 ]; then
echo "Client $client_id already exists"
return 0
fi
# Create client
curl -s -X POST \
-H "Authorization: Bearer $KC_TOKEN" \
Expand All @@ -246,7 +241,7 @@ GRANT
local id=$(curl -s \
-H "Authorization: Bearer $KC_TOKEN" \
"$KC_URL/auth/admin/realms/$realm/clients?clientId=$client_id" | jq -r '.[0].id')
"$KC_URL/auth/admin/realms/$realm/clients?clientId=$client_id")
echo $id
}
Expand Down

0 comments on commit e7c74fa

Please sign in to comment.