mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-21 09:05:10 +00:00
test-network error message if jq not installed
With removal of fabric-tools image, test-network now depends on jq being installed locally. This commit logs an error message if jq commands fail due to jq not being installed locally. Signed-off-by: David Enyeart <enyeart@us.ibm.com>
This commit is contained in:
parent
0db64487e5
commit
4763bcae8d
2 changed files with 6 additions and 1 deletions
|
|
@ -33,13 +33,15 @@ fetchChannelConfig() {
|
||||||
set -x
|
set -x
|
||||||
configtxlator proto_decode --input ${TEST_NETWORK_HOME}/channel-artifacts/config_block.pb --type common.Block --output ${TEST_NETWORK_HOME}/channel-artifacts/config_block.json
|
configtxlator proto_decode --input ${TEST_NETWORK_HOME}/channel-artifacts/config_block.pb --type common.Block --output ${TEST_NETWORK_HOME}/channel-artifacts/config_block.json
|
||||||
jq .data.data[0].payload.data.config ${TEST_NETWORK_HOME}/channel-artifacts/config_block.json >"${OUTPUT}"
|
jq .data.data[0].payload.data.config ${TEST_NETWORK_HOME}/channel-artifacts/config_block.json >"${OUTPUT}"
|
||||||
|
res=$?
|
||||||
{ set +x; } 2>/dev/null
|
{ set +x; } 2>/dev/null
|
||||||
|
verifyResult $res "Failed to parse channel configuration, make sure you have jq installed"
|
||||||
}
|
}
|
||||||
|
|
||||||
# createConfigUpdate <channel_id> <original_config.json> <modified_config.json> <output.pb>
|
# createConfigUpdate <channel_id> <original_config.json> <modified_config.json> <output.pb>
|
||||||
# Takes an original and modified config, and produces the config update tx
|
# Takes an original and modified config, and produces the config update tx
|
||||||
# which transitions between the two
|
# which transitions between the two
|
||||||
# NOTE: this requires configtxlator for execution.
|
# NOTE: this requires jq and configtxlator for execution.
|
||||||
createConfigUpdate() {
|
createConfigUpdate() {
|
||||||
CHANNEL=$1
|
CHANNEL=$1
|
||||||
ORIGINAL=$2
|
ORIGINAL=$2
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,10 @@ createAnchorPeerUpdate() {
|
||||||
set -x
|
set -x
|
||||||
# Modify the configuration to append the anchor peer
|
# Modify the configuration to append the anchor peer
|
||||||
jq '.channel_group.groups.Application.groups.'${CORE_PEER_LOCALMSPID}'.values += {"AnchorPeers":{"mod_policy": "Admins","value":{"anchor_peers": [{"host": "'$HOST'","port": '$PORT'}]},"version": "0"}}' ${TEST_NETWORK_HOME}/channel-artifacts/${CORE_PEER_LOCALMSPID}config.json > ${TEST_NETWORK_HOME}/channel-artifacts/${CORE_PEER_LOCALMSPID}modified_config.json
|
jq '.channel_group.groups.Application.groups.'${CORE_PEER_LOCALMSPID}'.values += {"AnchorPeers":{"mod_policy": "Admins","value":{"anchor_peers": [{"host": "'$HOST'","port": '$PORT'}]},"version": "0"}}' ${TEST_NETWORK_HOME}/channel-artifacts/${CORE_PEER_LOCALMSPID}config.json > ${TEST_NETWORK_HOME}/channel-artifacts/${CORE_PEER_LOCALMSPID}modified_config.json
|
||||||
|
res=$?
|
||||||
{ set +x; } 2>/dev/null
|
{ set +x; } 2>/dev/null
|
||||||
|
verifyResult $res "Channel configuration update for anchor peer failed, make sure you have jq installed"
|
||||||
|
|
||||||
|
|
||||||
# Compute a config update, based on the differences between
|
# Compute a config update, based on the differences between
|
||||||
# {orgmsp}config.json and {orgmsp}modified_config.json, write
|
# {orgmsp}config.json and {orgmsp}modified_config.json, write
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue