use USER instead of whoami (#1134)

* use USER instead of whoami

make gcloud_FigureRemoteUsername robust against unsolicited output
   (that I get on login ;) )

validate --prefix argument

* Update gcloud.sh
This commit is contained in:
Rob Walker
2018-09-07 00:18:05 +09:00
committed by GitHub
parent 6560b0e2cc
commit fdc48d521c
2 changed files with 14 additions and 11 deletions

View File

@ -6,7 +6,7 @@ source "$here"/../scripts/gcloud.sh
# shellcheck source=net/common.sh
source "$here"/common.sh
prefix=testnet-dev-$(id -un | sed -e s/[^a-z0-9].*//)
prefix=testnet-dev-${USER//[^A-Za-z0-9]/}
validatorNodeCount=5
clientNodeCount=1
leaderMachineType=n1-standard-16
@ -37,8 +37,8 @@ Configure a GCE-based testnet
delete - delete the testnet
common options:
-p prefix - Optional common prefix for instance names to avoid collisions
(default: $prefix)
-p prefix - Optional common prefix for instance names to avoid
collisions (default: $prefix)
create-specific options:
-n [number] - Number of validator nodes (default: $validatorNodeCount)
@ -71,6 +71,7 @@ while getopts "h?p:Pi:n:c:z:ga:" opt; do
usage
;;
p)
[[ ${OPTARG//[^A-Za-z0-9]/} == "$OPTARG" ]] || usage "Invalid prefix: \"$OPTARG\", alphanumeric only"
prefix=$OPTARG
;;
P)