mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 07:25:10 +00:00
Fix intermittent errors with test-network ca (#1305)
If CA server hasn't finished initialization then the initial register and enroll requests will fail. Instead of waiting 3 seconds, actually check if CA service is ready. Signed-off-by: David Enyeart <enyeart@us.ibm.com>
This commit is contained in:
parent
50699a6801
commit
8547618f06
1 changed files with 15 additions and 2 deletions
|
|
@ -224,10 +224,9 @@ function createOrgs() {
|
||||||
infoln "Generating certificates using Fabric CA"
|
infoln "Generating certificates using Fabric CA"
|
||||||
${CONTAINER_CLI_COMPOSE} -f compose/$COMPOSE_FILE_CA -f compose/$CONTAINER_CLI/${CONTAINER_CLI}-$COMPOSE_FILE_CA up -d 2>&1
|
${CONTAINER_CLI_COMPOSE} -f compose/$COMPOSE_FILE_CA -f compose/$CONTAINER_CLI/${CONTAINER_CLI}-$COMPOSE_FILE_CA up -d 2>&1
|
||||||
|
|
||||||
# Allow CAs to initialize and then make register and enroll requests
|
|
||||||
sleep 3
|
|
||||||
. organizations/fabric-ca/registerEnroll.sh
|
. organizations/fabric-ca/registerEnroll.sh
|
||||||
|
|
||||||
|
# Make sure CA files have been created
|
||||||
while :
|
while :
|
||||||
do
|
do
|
||||||
if [ ! -f "organizations/fabric-ca/org1/tls-cert.pem" ]; then
|
if [ ! -f "organizations/fabric-ca/org1/tls-cert.pem" ]; then
|
||||||
|
|
@ -237,6 +236,20 @@ function createOrgs() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Make sure CA service is initialized and can accept requests before making register and enroll calls
|
||||||
|
export FABRIC_CA_CLIENT_HOME=${PWD}/organizations/peerOrganizations/org1.example.com/
|
||||||
|
COUNTER=0
|
||||||
|
rc=1
|
||||||
|
while [[ $rc -ne 0 && $COUNTER -lt $MAX_RETRY ]]; do
|
||||||
|
sleep 1
|
||||||
|
set -x
|
||||||
|
fabric-ca-client getcainfo -u https://admin:adminpw@localhost:7054 --caname ca-org1 --tls.certfiles "${PWD}/organizations/fabric-ca/org1/ca-cert.pem"
|
||||||
|
res=$?
|
||||||
|
{ set +x; } 2>/dev/null
|
||||||
|
rc=$res # Update rc
|
||||||
|
COUNTER=$((COUNTER + 1))
|
||||||
|
done
|
||||||
|
|
||||||
infoln "Creating Org1 Identities"
|
infoln "Creating Org1 Identities"
|
||||||
|
|
||||||
createOrg1
|
createOrg1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue