Clean up arg handling

This commit is contained in:
Michael Vines 2018-09-07 08:46:20 -07:00
parent 09a48d773a
commit ab208ddb77
3 changed files with 27 additions and 21 deletions

View File

@ -1,4 +1,4 @@
#!/bin/bash -ex #!/bin/bash -e
cd "$(dirname "$0")"/../.. cd "$(dirname "$0")"/../..
@ -7,9 +7,14 @@ entrypointIp="$2"
numNodes="$3" numNodes="$3"
RUST_LOG="$4" RUST_LOG="$4"
[[ -n $deployMethod ]] || exit missing() {
[[ -n $entrypointIp ]] || exit echo "Error: $1 not specified"
[[ -n $numNodes ]] || exit exit 1
}
[[ -n $deployMethod ]] || missing deployMethod
[[ -n $entrypointIp ]] || missing entrypointIp
[[ -n $numNodes ]] || missing numNodes
source net/common.sh source net/common.sh
loadConfigFile loadConfigFile

View File

@ -1,4 +1,4 @@
#!/bin/bash -ex #!/bin/bash -e
cd "$(dirname "$0")"/../.. cd "$(dirname "$0")"/../..
@ -9,11 +9,16 @@ entrypointIp="$4"
numNodes="$5" numNodes="$5"
RUST_LOG="$6" RUST_LOG="$6"
[[ -n $deployMethod ]] || exit missing() {
[[ -n $nodeType ]] || exit echo "Error: $1 not specified"
[[ -n $publicNetwork ]] || exit exit 1
[[ -n $entrypointIp ]] || exit }
[[ -n $numNodes ]] || exit
[[ -n $deployMethod ]] || missing deployMethod
[[ -n $nodeType ]] || missing nodeType
[[ -n $publicNetwork ]] || missing publicNetwork
[[ -n $entrypointIp ]] || missing entrypointIp
[[ -n $numNodes ]] || missing numNodes
cat > deployConfig <<EOF cat > deployConfig <<EOF
deployMethod="$deployMethod" deployMethod="$deployMethod"

View File

@ -1,4 +1,4 @@
#!/bin/bash -ex #!/bin/bash -e
# #
# This script is to be run on the leader node # This script is to be run on the leader node
# #
@ -16,19 +16,15 @@ numNodes=
# shellcheck source=/dev/null # deployConfig is written by remote-node.sh # shellcheck source=/dev/null # deployConfig is written by remote-node.sh
source deployConfig source deployConfig
[[ -n $deployMethod ]] || { missing() {
echo deployMethod empty echo "Error: $1 not specified"
exit 1
}
[[ -n $entrypointIp ]] || {
echo entrypointIp empty
exit 1
}
[[ -n $numNodes ]] || {
echo numNodes empty
exit 1 exit 1
} }
[[ -n $deployMethod ]] || missing deployMethod
[[ -n $entrypointIp ]] || missing entrypointIp
[[ -n $numNodes ]] || missing numNodes
ledgerVerify=true ledgerVerify=true
validatorSanity=true validatorSanity=true
while [[ $1 = -o ]]; do while [[ $1 = -o ]]; do