Skip to content

Commit c0f0401

Browse files
committed
CH-231 fix update password
1 parent 3ed8131 commit c0f0401

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

applications/accounts/scripts/create_api_user.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ NAMESPACE=${CH_ACCOUNTS_REALM}
44
USERNAME=admin_api
55
PASSWORD=$(cat /opt/cloudharness/resources/auth/api_user_password)
66

7-
set -e
87
echo "Checking if API user exists..."
98

109
# Check if user already exists
1110
if /opt/keycloak/bin/kcadm.sh get users -q "username=$USERNAME" | grep -q "$USERNAME"; then
12-
echo "API user $USERNAME already exists, skipping creation"
11+
echo "API user $USERNAME already exists, syncing password to the one in the secret"
12+
/opt/keycloak/bin/kcadm.sh set-password --username "$USERNAME" --new-password "$PASSWORD"
1313
exit 0
1414
fi
1515

1616
echo "Creating API user $USERNAME"
1717

1818
# create the user and reload keycloak
1919
/opt/keycloak/bin/kcadm.sh create users -s "username=$USERNAME" -s enabled=True
20-
/opt/keycloak/bin/kcadm.sh set-password --username "$USERNAME" --new-password "$PASSWORD"
20+
2121
/opt/keycloak/bin/kcadm.sh add-roles --uusername "$USERNAME" --rolename admin
2222

2323
echo "API user created successfully"

0 commit comments

Comments
 (0)