mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-22 17:45:10 +00:00
FAB-10801 format and styling for shell artifacts
formatting for existing shell scripts Change-Id: I7e067730558bc55edc74b73e59195af7c825d8b2 Signed-off-by: Naga Pemmara <naga.pemmaraju@ibm.com>
This commit is contained in:
parent
e95210e9bc
commit
20ad472356
2 changed files with 277 additions and 268 deletions
|
|
@ -231,7 +231,6 @@ function upgradeNetwork () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Tear down running network
|
# Tear down running network
|
||||||
function networkDown() {
|
function networkDown() {
|
||||||
# stop org3 containers also in addition to org1 and org2, in case we were running sample to add org3
|
# stop org3 containers also in addition to org1 and org2, in case we were running sample to add org3
|
||||||
|
|
@ -259,7 +258,7 @@ function networkDown () {
|
||||||
function replacePrivateKey() {
|
function replacePrivateKey() {
|
||||||
# sed on MacOSX does not support -i flag with a null extension. We will use
|
# sed on MacOSX does not support -i flag with a null extension. We will use
|
||||||
# 't' for our back-up's extension and delete it at the end of the function
|
# 't' for our back-up's extension and delete it at the end of the function
|
||||||
ARCH=`uname -s | grep Darwin`
|
ARCH=$(uname -s | grep Darwin)
|
||||||
if [ "$ARCH" == "Darwin" ]; then
|
if [ "$ARCH" == "Darwin" ]; then
|
||||||
OPTS="-it"
|
OPTS="-it"
|
||||||
else
|
else
|
||||||
|
|
@ -454,7 +453,8 @@ IMAGETAG="latest"
|
||||||
if [ "$1" = "-m" ]; then # supports old usage, muscle memory is powerful!
|
if [ "$1" = "-m" ]; then # supports old usage, muscle memory is powerful!
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
MODE=$1;shift
|
MODE=$1
|
||||||
|
shift
|
||||||
# Determine whether starting, stopping, restarting, generating or upgrading
|
# Determine whether starting, stopping, restarting, generating or upgrading
|
||||||
if [ "$MODE" == "up" ]; then
|
if [ "$MODE" == "up" ]; then
|
||||||
EXPMODE="Starting"
|
EXPMODE="Starting"
|
||||||
|
|
@ -477,21 +477,29 @@ while getopts "h?c:t:d:f:s:l:i:v" opt; do
|
||||||
printHelp
|
printHelp
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
c) CHANNEL_NAME=$OPTARG
|
c)
|
||||||
|
CHANNEL_NAME=$OPTARG
|
||||||
;;
|
;;
|
||||||
t) CLI_TIMEOUT=$OPTARG
|
t)
|
||||||
|
CLI_TIMEOUT=$OPTARG
|
||||||
;;
|
;;
|
||||||
d) CLI_DELAY=$OPTARG
|
d)
|
||||||
|
CLI_DELAY=$OPTARG
|
||||||
;;
|
;;
|
||||||
f) COMPOSE_FILE=$OPTARG
|
f)
|
||||||
|
COMPOSE_FILE=$OPTARG
|
||||||
;;
|
;;
|
||||||
s) IF_COUCHDB=$OPTARG
|
s)
|
||||||
|
IF_COUCHDB=$OPTARG
|
||||||
;;
|
;;
|
||||||
l) LANGUAGE=$OPTARG
|
l)
|
||||||
|
LANGUAGE=$OPTARG
|
||||||
;;
|
;;
|
||||||
i) IMAGETAG=`uname -m`"-"$OPTARG
|
i)
|
||||||
|
IMAGETAG=$(uname -m)"-"$OPTARG
|
||||||
;;
|
;;
|
||||||
v) VERBOSE=true
|
v)
|
||||||
|
VERBOSE=true
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,6 @@ setGlobals () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
updateAnchorPeers() {
|
updateAnchorPeers() {
|
||||||
PEER=$1
|
PEER=$1
|
||||||
ORG=$2
|
ORG=$2
|
||||||
|
|
@ -104,7 +103,7 @@ joinChannelWithRetry () {
|
||||||
set +x
|
set +x
|
||||||
cat log.txt
|
cat log.txt
|
||||||
if [ $res -ne 0 -a $COUNTER -lt $MAX_RETRY ]; then
|
if [ $res -ne 0 -a $COUNTER -lt $MAX_RETRY ]; then
|
||||||
COUNTER=` expr $COUNTER + 1`
|
COUNTER=$(expr $COUNTER + 1)
|
||||||
echo "peer${PEER}.org${ORG} failed to join the channel, Retry after $DELAY seconds"
|
echo "peer${PEER}.org${ORG} failed to join the channel, Retry after $DELAY seconds"
|
||||||
sleep $DELAY
|
sleep $DELAY
|
||||||
joinChannelWithRetry $PEER $ORG
|
joinChannelWithRetry $PEER $ORG
|
||||||
|
|
@ -181,7 +180,8 @@ chaincodeQuery () {
|
||||||
|
|
||||||
# continue to poll
|
# continue to poll
|
||||||
# we either get a successful response, or reach TIMEOUT
|
# we either get a successful response, or reach TIMEOUT
|
||||||
while test "$(($(date +%s)-starttime))" -lt "$TIMEOUT" -a $rc -ne 0
|
while
|
||||||
|
test "$(($(date +%s) - starttime))" -lt "$TIMEOUT" -a $rc -ne 0
|
||||||
do
|
do
|
||||||
sleep $DELAY
|
sleep $DELAY
|
||||||
echo "Attempting to Query peer${PEER}.org${ORG} ...$(($(date +%s) - starttime)) secs"
|
echo "Attempting to Query peer${PEER}.org${ORG} ...$(($(date +%s) - starttime)) secs"
|
||||||
|
|
@ -285,7 +285,8 @@ parsePeerConnectionParameters() {
|
||||||
PEER_CONN_PARMS="$PEER_CONN_PARMS $TLSINFO"
|
PEER_CONN_PARMS="$PEER_CONN_PARMS $TLSINFO"
|
||||||
fi
|
fi
|
||||||
# shift by two to get the next pair of peer/org parameters
|
# shift by two to get the next pair of peer/org parameters
|
||||||
shift; shift
|
shift
|
||||||
|
shift
|
||||||
done
|
done
|
||||||
# remove leading space for output
|
# remove leading space for output
|
||||||
PEERS="$(echo -e "$PEERS" | sed -e 's/^[[:space:]]*//')"
|
PEERS="$(echo -e "$PEERS" | sed -e 's/^[[:space:]]*//')"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue