mirror of
https://github.com/harivansh-afk/betterNAS.git
synced 2026-04-15 07:04:44 +00:00
Keep stack verification idempotent under node auth.
Use a unique machine ID for each stack verification run so repeated checks against a persisted control-plane state keep exercising the bootstrap flow without failing on node-scoped re-registration auth. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
ed40da7326
commit
8e0636f6a3
1 changed files with 4 additions and 1 deletions
|
|
@ -9,6 +9,9 @@ source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../lib/runtime-env.sh"
|
||||||
"$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/verify-webdav"
|
"$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/verify-webdav"
|
||||||
|
|
||||||
control_health="$(curl -fsS "http://localhost:${BETTERNAS_CONTROL_PLANE_PORT}/health")"
|
control_health="$(curl -fsS "http://localhost:${BETTERNAS_CONTROL_PLANE_PORT}/health")"
|
||||||
|
verify_run_id="$(date +%s)-$$"
|
||||||
|
node_machine_id="${BETTERNAS_CLONE_NAME}-machine-${verify_run_id}"
|
||||||
|
|
||||||
echo "$control_health" | jq -e '.service == "control-plane" and .status == "ok"' >/dev/null
|
echo "$control_health" | jq -e '.service == "control-plane" and .status == "ok"' >/dev/null
|
||||||
|
|
||||||
register_headers="$(mktemp)"
|
register_headers="$(mktemp)"
|
||||||
|
|
@ -23,7 +26,7 @@ curl -fsS \
|
||||||
-H "Authorization: Bearer ${BETTERNAS_CONTROL_PLANE_NODE_BOOTSTRAP_TOKEN}" \
|
-H "Authorization: Bearer ${BETTERNAS_CONTROL_PLANE_NODE_BOOTSTRAP_TOKEN}" \
|
||||||
-d @- \
|
-d @- \
|
||||||
"http://localhost:${BETTERNAS_CONTROL_PLANE_PORT}/api/v1/nodes/register" <<JSON
|
"http://localhost:${BETTERNAS_CONTROL_PLANE_PORT}/api/v1/nodes/register" <<JSON
|
||||||
{"machineId":"${BETTERNAS_CLONE_NAME}-machine","displayName":"${BETTERNAS_CLONE_NAME} node","agentVersion":"${BETTERNAS_VERSION}","directAddress":"${BETTERNAS_NODE_DIRECT_ADDRESS}","relayAddress":null,"exports":[{"label":"integration","path":"${BETTERNAS_EXPORT_PATH}","mountPath":"/dav/","protocols":["webdav"],"capacityBytes":null,"tags":["integration"]}]}
|
{"machineId":"${node_machine_id}","displayName":"${BETTERNAS_CLONE_NAME} node","agentVersion":"${BETTERNAS_VERSION}","directAddress":"${BETTERNAS_NODE_DIRECT_ADDRESS}","relayAddress":null,"exports":[{"label":"integration","path":"${BETTERNAS_EXPORT_PATH}","mountPath":"/dav/","protocols":["webdav"],"capacityBytes":null,"tags":["integration"]}]}
|
||||||
JSON
|
JSON
|
||||||
|
|
||||||
register_response="$(cat "$register_body")"
|
register_response="$(cat "$register_body")"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue