From e7c74fa9e1f50d74109763ff633b259b7525a64f Mon Sep 17 00:00:00 2001 From: "Matthew C. Morgan" Date: Mon, 28 Apr 2025 19:55:54 -0400 Subject: [PATCH] remove jq pieces --- config_job.tf | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/config_job.tf b/config_job.tf index 63b9f36..d103214 100644 --- a/config_job.tf +++ b/config_job.tf @@ -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" @@ -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 \ @@ -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 \ @@ -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" \ @@ -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 }