From 26736e494c004b841ffd37b40fc62432d33ec006 Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Fri, 22 May 2015 14:12:36 +0900 Subject: [PATCH 1/2] Check that s3 bucket has been created Fixes #8395 --- cluster/aws/util.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cluster/aws/util.sh b/cluster/aws/util.sh index d0e60d2e4c0..a22cdca22c8 100644 --- a/cluster/aws/util.sh +++ b/cluster/aws/util.sh @@ -270,6 +270,23 @@ function upload-server-tars() { # We default to us-east-1 because that's the canonical region for S3, # and then the bucket is most-simply named (s3.amazonaws.com) aws s3 mb "s3://${AWS_S3_BUCKET}" --region ${AWS_S3_REGION} + + local attempt=0 + while true; do + if ! aws s3 ls "s3://${AWS_S3_BUCKET}" > /dev/null 2>&1; then + if (( attempt > 5 )); then + echo + echo -e "Unable to confirm bucket creation." >&2 + echo "Please ensure that s3://${AWS_S3_BUCKET} exists" >&2 + echo -e "and run the script again. (sorry!)" >&2 + exit 1 + fi + else + break + fi + attempt=$(($attempt+1)) + sleep 1 + done fi local s3_bucket_location=$(aws --output text s3api get-bucket-location --bucket ${AWS_S3_BUCKET}) From e7ae425385583eaed1ec85009f80ec1d7ecc40db Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Sat, 23 May 2015 16:12:24 +0900 Subject: [PATCH 2/2] Colorize errors for consistency with other checks --- cluster/aws/util.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cluster/aws/util.sh b/cluster/aws/util.sh index a22cdca22c8..a7d59825b2f 100644 --- a/cluster/aws/util.sh +++ b/cluster/aws/util.sh @@ -276,9 +276,9 @@ function upload-server-tars() { if ! aws s3 ls "s3://${AWS_S3_BUCKET}" > /dev/null 2>&1; then if (( attempt > 5 )); then echo - echo -e "Unable to confirm bucket creation." >&2 + echo -e "${color_red}Unable to confirm bucket creation." >&2 echo "Please ensure that s3://${AWS_S3_BUCKET} exists" >&2 - echo -e "and run the script again. (sorry!)" >&2 + echo -e "and run the script again. (sorry!)${color_norm}" >&2 exit 1 fi else @@ -738,9 +738,9 @@ function kube-up { if [[ "${output}" != "working" ]]; then if (( attempt > 9 )); then echo - echo -e "Your cluster is unlikely to work correctly." >&2 + echo -e "${color_red}Your cluster is unlikely to work correctly." >&2 echo "Please run ./cluster/kube-down.sh and re-create the" >&2 - echo -e "cluster. (sorry!)" >&2 + echo -e "cluster. (sorry!)${color_norm}" >&2 exit 1 fi else