Skip to content

Commit 24833da

Browse files
authored
Merge pull request #25 from pilot-protocol/fix/snapshot-token
fix(ops): snapshot.sh sends peer_auth_token to /admin/checkpoint
2 parents 1340230 + eeae554 commit 24833da

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

scripts/snapshot.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@
1111
set -euo pipefail
1212

1313
ADMIN_URL="${COSIFT_ADMIN_URL:-http://127.0.0.1:7777}"
14-
ADMIN_TOKEN="${COSIFT_ADMIN_TOKEN:-}"
1514
CONFIG="${COSIFT_CONFIG:-/home/ubuntu/cosift.json}"
15+
ADMIN_TOKEN="${COSIFT_ADMIN_TOKEN:-}"
16+
# /admin/checkpoint is gated by cluster.peer_auth_token. When the token isn't
17+
# passed via env, read it from the config so scheduled snapshots keep working
18+
# once the token is set (matches the harvesters + cosift-compact.sh).
19+
if [[ -z "$ADMIN_TOKEN" ]]; then
20+
ADMIN_TOKEN="$(python3 -c "import json,sys;print(json.load(open(sys.argv[1])).get('cluster',{}).get('peer_auth_token',''))" "$CONFIG" 2>/dev/null || true)"
21+
fi
1622
BUCKET="${COSIFT_GCS_BUCKET:-gs://pilot-cosift-index}"
1723
KEEP="${COSIFT_KEEP:-14}"
1824

0 commit comments

Comments
 (0)