Fix naming conflict and redo formatting

This commit is contained in:
Sergey Dudoladov 2018-01-30 12:24:35 +01:00
parent 105bbdb8e4
commit f1bcdd1a8e
1 changed files with 70 additions and 73 deletions

View File

@ -21,15 +21,15 @@ readonly OPERATOR_PORT="8080"
# so the script retries actions until all the resources become available # so the script retries actions until all the resources become available
function retry(){ function retry(){
# errexit may break "eval $cmd", so we disable it temporarily # errexit may break "eval $retry_cmd", so we disable it temporarily
set +o errexit set +o errexit
local -r cmd="$1" local -r retry_cmd="$1"
local -r retry_msg="$2" local -r retry_msg="$2"
# times out after 1 minute # times out after 1 minute
for i in {1..20}; do for i in {1..20}; do
if eval "$cmd"; then if eval "$retry_cmd"; then
set -o errexit # enable again set -o errexit # enable again
return 0 return 0
fi fi
@ -37,7 +37,7 @@ function retry(){
sleep 3 sleep 3
done done
>2& echo "The command $cmd timed out" >2& echo "The command $retry_cmd timed out"
return 1 return 1
} }
@ -188,16 +188,14 @@ function check_health(){
echo "To stop it cleanly, run 'minikube delete'" echo "To stop it cleanly, run 'minikube delete'"
else else
>2& echo "==== FAILURE: OPERATOR DID NOT START OR PORT FORWARDING DID NOT WORK" >2& echo "==== FAILURE: OPERATOR DID NOT START OR PORT FORWARDING DID NOT WORK"
>2& echo "This *might* have left the minikube VM image in inconsistent state."
exit 1 exit 1
fi fi
} }
function main(){ function main(){
if ! [[ $(basename $PWD) == "postgres-operator" ]]; then if ! [[ $(basename "$PWD") == "postgres-operator" ]]; then
echo "Please execute the script only from the root directory of the Postgres opepator repo." echo "Please execute the script only from the root directory of the Postgres opepator repo."
exit 1 exit 1
fi fi
@ -233,4 +231,3 @@ function main(){
main "$@" main "$@"