From 77a65685c5dfc9f6fb1f1d44042f920ac255d54e Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Mon, 2 Apr 2018 13:56:05 -0400 Subject: [PATCH] FAB-9294 eliminate excess noise in BYFN eliminate the noise of echoing the environment variables for each command and add -v option to enable the noise for debug purposes for byfn.sh and eyfn.sh in first-network sample also eliminate noise in fabcar Change-Id: I46c377360efbab598fd37c0a31b29a119b99173e Signed-off-by: Christopher Ferris --- basic-network/docker-compose.yml | 10 +++++----- basic-network/teardown.sh | 1 + first-network/byfn.sh | 10 +++++++--- first-network/eyfn.sh | 16 ++++++++++------ first-network/scripts/script.sh | 2 ++ first-network/scripts/step1org3.sh | 2 ++ first-network/scripts/step2org3.sh | 2 ++ first-network/scripts/step3org3.sh | 2 ++ first-network/scripts/testorg3.sh | 2 ++ first-network/scripts/upgrade_to_v11.sh | 2 ++ first-network/scripts/utils.sh | 4 +++- 11 files changed, 38 insertions(+), 15 deletions(-) diff --git a/basic-network/docker-compose.yml b/basic-network/docker-compose.yml index bfad9d952a..2ebe3a43d8 100644 --- a/basic-network/docker-compose.yml +++ b/basic-network/docker-compose.yml @@ -18,7 +18,7 @@ services: - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/4239aa0dcd76daeeb8ba0cda701851d14504d31aad1b2ddddbac6a57365e497c_sk ports: - "7054:7054" - command: sh -c 'fabric-ca-server start -b admin:adminpw -d' + command: sh -c 'fabric-ca-server start -b admin:adminpw' volumes: - ./crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config container_name: ca.example.com @@ -29,7 +29,7 @@ services: container_name: orderer.example.com image: hyperledger/fabric-orderer environment: - - ORDERER_GENERAL_LOGLEVEL=debug + - ORDERER_GENERAL_LOGLEVEL=info - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_GENESISMETHOD=file - ORDERER_GENERAL_GENESISFILE=/etc/hyperledger/configtx/genesis.block @@ -52,8 +52,8 @@ services: environment: - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - CORE_PEER_ID=peer0.org1.example.com - - CORE_LOGGING_PEER=debug - - CORE_CHAINCODE_LOGGING_LEVEL=DEBUG + - CORE_LOGGING_PEER=info + - CORE_CHAINCODE_LOGGING_LEVEL=info - CORE_PEER_LOCALMSPID=Org1MSP - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/ - CORE_PEER_ADDRESS=peer0.org1.example.com:7051 @@ -105,7 +105,7 @@ services: environment: - GOPATH=/opt/gopath - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - CORE_LOGGING_LEVEL=DEBUG + - CORE_LOGGING_LEVEL=info - CORE_PEER_ID=cli - CORE_PEER_ADDRESS=peer0.org1.example.com:7051 - CORE_PEER_LOCALMSPID=Org1MSP diff --git a/basic-network/teardown.sh b/basic-network/teardown.sh index 70367930e8..189b6070c4 100755 --- a/basic-network/teardown.sh +++ b/basic-network/teardown.sh @@ -14,6 +14,7 @@ docker-compose -f docker-compose.yml kill && docker-compose -f docker-compose.ym rm -f ~/.hfc-key-store/* # remove chaincode docker images +docker rm $(docker ps -aq) docker rmi $(docker images dev-* -q) # Your system is now clean diff --git a/first-network/byfn.sh b/first-network/byfn.sh index a10e0a361e..39d6ce07ab 100755 --- a/first-network/byfn.sh +++ b/first-network/byfn.sh @@ -30,6 +30,7 @@ # this may be commented out to resolve installed version of tools if desired export PATH=${PWD}/../bin:${PWD}:$PATH export FABRIC_CFG_PATH=${PWD} +export VERBOSE=false # Print the usage message function printHelp () { @@ -49,6 +50,7 @@ function printHelp () { echo " -s - the database backend to use: goleveldb (default) or couchdb" echo " -l - the chaincode language: golang (default) or node" echo " -i - the tag to be used to launch the network (defaults to \"latest\")" + echo " -v - verbose mode" echo echo "Typically, one would first generate the required certificates and " echo "genesis block, then bring up the network. e.g.:" @@ -163,7 +165,7 @@ function networkUp () { exit 1 fi # now run the end to end script - docker exec cli scripts/script.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT + docker exec cli scripts/script.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE if [ $? -ne 0 ]; then echo "ERROR !!!! Test failed" exit 1 @@ -222,7 +224,7 @@ function upgradeNetwork () { docker-compose $COMPOSE_FILES up -d --no-deps $PEER done - docker exec cli scripts/upgrade_to_v11.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT + docker exec cli scripts/upgrade_to_v11.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE if [ $? -ne 0 ]; then echo "ERROR !!!! Test failed" exit 1 @@ -465,7 +467,7 @@ else exit 1 fi -while getopts "h?m:c:t:d:f:s:l:i:" opt; do +while getopts "h?m:c:t:d:f:s:l:i:v" opt; do case "$opt" in h|\?) printHelp @@ -485,6 +487,8 @@ while getopts "h?m:c:t:d:f:s:l:i:" opt; do ;; i) IMAGETAG=`uname -m`"-"$OPTARG ;; + v) VERBOSE=true + ;; esac done diff --git a/first-network/eyfn.sh b/first-network/eyfn.sh index b6783aacec..7447388864 100755 --- a/first-network/eyfn.sh +++ b/first-network/eyfn.sh @@ -14,6 +14,7 @@ # this may be commented out to resolve installed version of tools if desired export PATH=${PWD}/../bin:${PWD}:$PATH export FABRIC_CFG_PATH=${PWD} +export VERBOSE=false # Print the usage message function printHelp () { @@ -32,6 +33,7 @@ function printHelp () { echo " -s - the database backend to use: goleveldb (default) or couchdb" echo " -l - the chaincode language: golang (default) or node" echo " -i - the tag to be used to launch the network (defaults to \"latest\")" + echo " -v - verbose mode" echo echo "Typically, one would first generate the required certificates and " echo "genesis block, then bring up the network. e.g.:" @@ -80,7 +82,7 @@ function clearContainers () { # specifically the following images are often left behind: # TODO list generated image naming patterns function removeUnwantedImages() { - DOCKER_IMAGE_IDS=$(docker images | grep "dev\|none\|test-vp\|peer[0-9]-" | awk '{print $3}') + DOCKER_IMAGE_IDS=$(docker images|awk '($1 ~ /dev-peer.*.mycc.*/) {print $3}') if [ -z "$DOCKER_IMAGE_IDS" -o "$DOCKER_IMAGE_IDS" == " " ]; then echo "---- No images available for deletion ----" else @@ -110,7 +112,7 @@ function networkUp () { echo "###############################################################" echo "############### Have Org3 peers join network ##################" echo "###############################################################" - docker exec Org3cli ./scripts/step2org3.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT + docker exec Org3cli ./scripts/step2org3.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE if [ $? -ne 0 ]; then echo "ERROR !!!! Unable to have Org3 peers join network" exit 1 @@ -119,13 +121,13 @@ function networkUp () { echo "###############################################################" echo "##### Upgrade chaincode to have Org3 peers on the network #####" echo "###############################################################" - docker exec cli ./scripts/step3org3.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT + docker exec cli ./scripts/step3org3.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE if [ $? -ne 0 ]; then echo "ERROR !!!! Unable to add Org3 peers on network" exit 1 fi # finish by running the test - docker exec Org3cli ./scripts/testorg3.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT + docker exec Org3cli ./scripts/testorg3.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE if [ $? -ne 0 ]; then echo "ERROR !!!! Unable to run test" exit 1 @@ -160,7 +162,7 @@ function createConfigTx () { echo "###############################################################" echo "####### Generate and submit config tx to add Org3 #############" echo "###############################################################" - docker exec cli scripts/step1org3.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT + docker exec cli scripts/step1org3.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE if [ $? -ne 0 ]; then echo "ERROR !!!! Unable to create config tx" exit 1 @@ -271,7 +273,7 @@ else printHelp exit 1 fi -while getopts "h?c:t:d:f:s:l:i:" opt; do +while getopts "h?c:t:d:f:s:l:i:v" opt; do case "$opt" in h|\?) printHelp @@ -291,6 +293,8 @@ while getopts "h?c:t:d:f:s:l:i:" opt; do ;; i) IMAGETAG=$OPTARG ;; + v) VERBOSE=true + ;; esac done diff --git a/first-network/scripts/script.sh b/first-network/scripts/script.sh index 5762cb253f..7823d6004d 100755 --- a/first-network/scripts/script.sh +++ b/first-network/scripts/script.sh @@ -13,10 +13,12 @@ CHANNEL_NAME="$1" DELAY="$2" LANGUAGE="$3" TIMEOUT="$4" +VERBOSE="$5" : ${CHANNEL_NAME:="mychannel"} : ${DELAY:="3"} : ${LANGUAGE:="golang"} : ${TIMEOUT:="10"} +: ${VERBOSE:="false"} LANGUAGE=`echo "$LANGUAGE" | tr [:upper:] [:lower:]` COUNTER=1 MAX_RETRY=5 diff --git a/first-network/scripts/step1org3.sh b/first-network/scripts/step1org3.sh index ad607e35b6..2efb64da62 100755 --- a/first-network/scripts/step1org3.sh +++ b/first-network/scripts/step1org3.sh @@ -15,10 +15,12 @@ CHANNEL_NAME="$1" DELAY="$2" LANGUAGE="$3" TIMEOUT="$4" +VERBOSE="$5" : ${CHANNEL_NAME:="mychannel"} : ${DELAY:="3"} : ${LANGUAGE:="golang"} : ${TIMEOUT:="10"} +: ${VERBOSE:="false"} LANGUAGE=`echo "$LANGUAGE" | tr [:upper:] [:lower:]` COUNTER=1 MAX_RETRY=5 diff --git a/first-network/scripts/step2org3.sh b/first-network/scripts/step2org3.sh index 41268c4b40..f4df00d4be 100755 --- a/first-network/scripts/step2org3.sh +++ b/first-network/scripts/step2org3.sh @@ -18,10 +18,12 @@ CHANNEL_NAME="$1" DELAY="$2" LANGUAGE="$3" TIMEOUT="$4" +VERBOSE="$5" : ${CHANNEL_NAME:="mychannel"} : ${DELAY:="3"} : ${LANGUAGE:="golang"} : ${TIMEOUT:="10"} +: ${VERBOSE:="false"} LANGUAGE=`echo "$LANGUAGE" | tr [:upper:] [:lower:]` COUNTER=1 MAX_RETRY=5 diff --git a/first-network/scripts/step3org3.sh b/first-network/scripts/step3org3.sh index 585fa203f0..895a451329 100755 --- a/first-network/scripts/step3org3.sh +++ b/first-network/scripts/step3org3.sh @@ -19,10 +19,12 @@ CHANNEL_NAME="$1" DELAY="$2" LANGUAGE="$3" TIMEOUT="$4" +VERBOSE="$5" : ${CHANNEL_NAME:="mychannel"} : ${DELAY:="3"} : ${LANGUAGE:="golang"} : ${TIMEOUT:="10"} +: ${VERBOSE:="false"} LANGUAGE=`echo "$LANGUAGE" | tr [:upper:] [:lower:]` COUNTER=1 MAX_RETRY=5 diff --git a/first-network/scripts/testorg3.sh b/first-network/scripts/testorg3.sh index 1668f45efb..7c3685e8b8 100755 --- a/first-network/scripts/testorg3.sh +++ b/first-network/scripts/testorg3.sh @@ -24,9 +24,11 @@ CHANNEL_NAME="$1" DELAY="$2" LANGUAGE="$3" TIMEOUT="$4" +VERBOSE="$5" : ${CHANNEL_NAME:="mychannel"} : ${TIMEOUT:="10"} : ${LANGUAGE:="golang"} +: ${VERBOSE:="false"} LANGUAGE=`echo "$LANGUAGE" | tr [:upper:] [:lower:]` COUNTER=1 MAX_RETRY=5 diff --git a/first-network/scripts/upgrade_to_v11.sh b/first-network/scripts/upgrade_to_v11.sh index 69eb2fbda2..54ee890555 100755 --- a/first-network/scripts/upgrade_to_v11.sh +++ b/first-network/scripts/upgrade_to_v11.sh @@ -13,10 +13,12 @@ CHANNEL_NAME="$1" DELAY="$2" LANGUAGE="$3" TIMEOUT="$4" +VERBOSE="$5" : ${CHANNEL_NAME:="mychannel"} : ${DELAY:="5"} : ${LANGUAGE:="golang"} : ${TIMEOUT:="10"} +: ${VERBOSE:="false"} LANGUAGE=`echo "$LANGUAGE" | tr [:upper:] [:lower:]` COUNTER=1 MAX_RETRY=5 diff --git a/first-network/scripts/utils.sh b/first-network/scripts/utils.sh index 7509147e3b..5a4459e99a 100755 --- a/first-network/scripts/utils.sh +++ b/first-network/scripts/utils.sh @@ -59,7 +59,9 @@ setGlobals () { echo "================== ERROR !!! ORG Unknown ==================" fi - env |grep CORE + if [ "$VERBOSE" == "true" ]; then + env |grep CORE + fi }