|
4 | 4 | # === Constants === |
5 | 5 | VAULT_ENDPOINT=http://127.0.0.1:8600 |
6 | 6 | REGION=us-east-1 |
7 | | -PROFILE=management |
| 7 | +PROFILE=scality-internal-services |
8 | 8 | # CONFIG_FILE=/config/backbeat-config.json |
9 | 9 |
|
10 | 10 | # === Environment Echo === |
@@ -35,34 +35,22 @@ echo "[setup] vaultclient configured with /tmp/vaultclient.conf" |
35 | 35 | echo |
36 | 36 |
|
37 | 37 | # === Create management account === |
38 | | -echo "[setup] Checking if management account already exists..." |
39 | | -if ./node_modules/vaultclient/bin/vaultclient list-accounts --host 127.0.0.1 --port 8600 | jq -e '.accounts[] | select(.name=="management")' > /dev/null; then |
40 | | - echo "[setup] Management account already exists, skipping creation." |
41 | | -else |
42 | | - echo "[setup] Creating management account..." |
43 | | - ./node_modules/vaultclient/bin/vaultclient create-account --name management --email dev@null --host 127.0.0.1 --port 8600 --accountid 000000000000 |
44 | | - echo |
45 | | -fi |
46 | 38 |
|
47 | 39 | MANAGEMENT_ACCESS_KEY=$(jq -r '.accessKey' /conf/management-creds.json) |
48 | 40 | MANAGEMENT_SECRET_KEY=$(jq -r '.secretKey' /conf/management-creds.json) |
49 | 41 |
|
50 | | -echo "[setup] Creating access key for management account..." |
| 42 | +echo "[setup] Ensure management account is configured..." |
51 | 43 | resp=$(./node_modules/vaultclient/bin/vaultclient \ |
52 | | - generate-account-access-key \ |
| 44 | + ensure-internal-services-account \ |
53 | 45 | --host 127.0.0.1 \ |
54 | 46 | --port 8600 \ |
55 | | - --name management \ |
56 | 47 | --accesskey "$MANAGEMENT_ACCESS_KEY" \ |
57 | 48 | --secretkey "$MANAGEMENT_SECRET_KEY") |
| 49 | + |
58 | 50 | if [ $? -ne 0 ]; then |
59 | | - if echo "$resp" | grep -q EntityAlreadyExists; then |
60 | | - echo "[setup] Access key already exists for management account." |
61 | | - else |
62 | | - echo "[setup] Error creating access key for management account:" |
63 | | - echo "$resp" |
64 | | - exit 1 |
65 | | - fi |
| 51 | + echo "[setup] Error configuring management account:" |
| 52 | + echo "$resp" |
| 53 | + exit 1 |
66 | 54 | fi |
67 | 55 |
|
68 | 56 | echo "[setup] Management account and access key setup completed successfully 🎉" |
|
0 commit comments