From 1b7ce3451eab021ae81fe229ca0ce9afc201f600 Mon Sep 17 00:00:00 2001 From: justinschuldt Date: Fri, 1 Apr 2022 11:14:39 -0500 Subject: [PATCH] make update-guardian-set.sh idempotent --- scripts/update-guardian-set.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/update-guardian-set.sh b/scripts/update-guardian-set.sh index db87c5b6b..cab472dbb 100755 --- a/scripts/update-guardian-set.sh +++ b/scripts/update-guardian-set.sh @@ -4,7 +4,7 @@ set -e # wait for the guardians to establish networking -sleep 30 +sleep 3 newNumGuardians=$1 echo "new number of guardians: ${newNumGuardians}" @@ -19,6 +19,7 @@ containerPath=/tmp/$fileName echo "localPath: ${localPath}" echo "containerPath: ${containerPath}" +# the admin socket of the devnet guardians. used for executing commands in guardian pods. sock=/tmp/admin.sock guardianPublicWebBaseUrl="${webHost}:7071" @@ -32,6 +33,12 @@ currentNumGuardians=$(echo ${guardianSet} | jq ".addresses | length") echo "currentIndex: ${currentIndex}" echo "currentNumGuardians ${currentNumGuardians}" + +if [ ${currentNumGuardians} == ${newNumGuardians} ]; then + echo "number of guardians is as expected." + exit 0 +fi + echo "creating guardian set update governance message template prototext" minikube kubectl -- exec -n wormhole guardian-0 -c guardiand -- /guardiand template guardian-set-update --num=${newNumGuardians} --idx=${currentIndex} > ${localPath}