Use more flexible parameter

pull/135/head
Baohua Yang 2019-05-02 15:22:34 +08:00
parent ff5f28faa1
commit 226fa2f54f
2 changed files with 15 additions and 6 deletions

View File

@ -103,16 +103,19 @@ checkOSNAvailability() {
channelCreateAction(){
local channel=$1
local channel_tx=$2
local orderer_url=$3
[ -z $orderer_url ] && orderer_url=${ORDERER_URL}
if [ -z "$CORE_PEER_TLS_ENABLED" ] || [ "$CORE_PEER_TLS_ENABLED" = "false" ]; then
peer channel create \
-o ${ORDERER_URL} \
-o ${orderer_url} \
-c ${channel} \
-f ${CHANNEL_ARTIFACTS}/${channel_tx} \
--timeout "${TIMEOUT}s" \
>&log.txt
else
peer channel create \
-o ${ORDERER_URL} \
-o ${orderer_url} \
-c ${channel} \
-f ${CHANNEL_ARTIFACTS}/${channel_tx} \
--timeout "${TIMEOUT}s" \
@ -124,12 +127,14 @@ channelCreateAction(){
}
# Use peer0/org1 to create a channel
# channelCreate APP_CHANNEL APP_CHANNEL.tx org peer
# channelCreate APP_CHANNEL APP_CHANNEL.tx org peer [orderer]
channelCreate() {
local channel=$1
local tx=$2
local org=$3
local peer=$4
local orderer_url=$5
[ -z $orderer_url ] && orderer_url=${ORDERER_URL}
[ -z $channel ] && [ -z $tx ] && [ -z $org ] && [ -z $peer ] && echo_r "input param invalid" && exit -1
@ -138,7 +143,7 @@ channelCreate() {
local rc=1
local counter=0
while [ ${counter} -lt ${MAX_RETRY} -a ${rc} -ne 0 ]; do
channelCreateAction "${channel}" "${tx}"
channelCreateAction "${channel}" "${tx}" "${orderer_url}"
rc=$?
let counter=${counter}+1
#COUNTER=` expr $COUNTER + 1`

View File

@ -18,7 +18,7 @@ SYS_CHANNEL="testchainid"
APP_CHANNEL="businesschannel"
# Client cmd execute timeout and retry times
TIMEOUT="60"
TIMEOUT="90"
MAX_RETRY=10
# Organization and peers
@ -105,10 +105,14 @@ GEN_CONTAINER=generator
FABRIC_CFG_PATH=/etc/hyperledger/fabric
CHANNEL_ARTIFACTS=channel-artifacts
CRYPTO_CONFIG=crypto-config
ORDERER_GENESIS=orderer.genesis.block
ORDERER0_GENESIS=orderer0.genesis.block
ORDERER1_GENESIS=orderer1.genesis.block
ORDERER_GENESIS=${ORDERER1_GENESIS}
ORDERER_GENESIS_PROFILE=TwoOrgsOrdererGenesis
APP_CHANNEL_PROFILE=TwoOrgsChannel
APP_CHANNEL_TX=${APP_CHANNEL}.tx
APP_CHANNEL1_TX=${APP_CHANNEL1}.tx
APP_CHANNEL2_TX=${APP_CHANNEL2}.tx
UPDATE_ANCHOR_ORG1_TX=Org1MSPanchors.tx
UPDATE_ANCHOR_ORG2_TX=Org2MSPanchors.tx