diff --git a/cluster/aws/util.sh b/cluster/aws/util.sh index 0b726f55682..065fef7a4bb 100644 --- a/cluster/aws/util.sh +++ b/cluster/aws/util.sh @@ -87,7 +87,7 @@ function detect-minions () { echo "Found ${MINION_NAMES[$i]} at ${minion_ip}" KUBE_MINION_IP_ADDRESSES+=("${minion_ip}") done - if [ -z "$KUBE_MINION_IP_ADDRESSES" ]; then + if [[ -z "$KUBE_MINION_IP_ADDRESSES" ]]; then echo "Could not detect Kubernetes minion nodes. Make sure you've launched a cluster with 'kube-up.sh'" exit 1 fi @@ -156,7 +156,7 @@ function detect-image () { # Verify prereqs function verify-prereqs { - if [ "$(which aws)" == "" ]; then + if [[ "$(which aws)" == "" ]]; then echo "Can't find aws in PATH, please fix and retry." exit 1 fi @@ -341,7 +341,7 @@ function kube-up { local htpasswd htpasswd=$(cat "${KUBE_TEMP}/htpasswd") - if [ ! -f $AWS_SSH_KEY ]; then + if [[ ! -f $AWS_SSH_KEY ]]; then ssh-keygen -f $AWS_SSH_KEY -N '' fi @@ -351,7 +351,7 @@ function kube-up { VPC_ID=$($AWS_CMD describe-vpcs | get_vpc_id) - if [ -z "$VPC_ID" ]; then + if [[ -z "$VPC_ID" ]]; then echo "Creating vpc." VPC_ID=$($AWS_CMD create-vpc --cidr-block 172.20.0.0/16 | json_val '["Vpc"]["VpcId"]') $AWS_CMD modify-vpc-attribute --vpc-id $VPC_ID --enable-dns-support '{"Value": true}' > $LOG @@ -362,7 +362,7 @@ function kube-up { echo "Using VPC $VPC_ID" SUBNET_ID=$($AWS_CMD describe-subnets | get_subnet_id $VPC_ID) - if [ -z "$SUBNET_ID" ]; then + if [[ -z "$SUBNET_ID" ]]; then echo "Creating subnet." SUBNET_ID=$($AWS_CMD create-subnet --cidr-block 172.20.0.0/24 --vpc-id $VPC_ID | json_val '["Subnet"]["SubnetId"]') fi @@ -370,7 +370,7 @@ function kube-up { echo "Using subnet $SUBNET_ID" IGW_ID=$($AWS_CMD describe-internet-gateways | get_igw_id $VPC_ID) - if [ -z "$IGW_ID" ]; then + if [[ -z "$IGW_ID" ]]; then echo "Creating Internet Gateway." IGW_ID=$($AWS_CMD create-internet-gateway | json_val '["InternetGateway"]["InternetGatewayId"]') $AWS_CMD attach-internet-gateway --internet-gateway-id $IGW_ID --vpc-id $VPC_ID > $LOG @@ -390,7 +390,7 @@ function kube-up { SEC_GROUP_ID=$($AWS_CMD describe-security-groups | get_sec_group_id) - if [ -z "$SEC_GROUP_ID" ]; then + if [[ -z "$SEC_GROUP_ID" ]]; then echo "Creating security group." SEC_GROUP_ID=$($AWS_CMD create-security-group --group-name kubernetes-sec-group --description kubernetes-sec-group --vpc-id $VPC_ID | json_val '["GroupId"]') $AWS_CMD authorize-security-group-ingress --group-id $SEC_GROUP_ID --protocol -1 --port all --cidr 0.0.0.0/0 > $LOG @@ -805,7 +805,7 @@ function ssh-to-node { local cmd="$2" local ip=$(get_instance_public_ip ${node}) - if [ -z "ip" ]; then + if [[ -z "ip" ]]; then echo "Could not detect IP for ${node}." exit 1 fi