File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,9 +15,7 @@ function check-elb-service {
1515 rigger-log " Waiting for ELB (${elb_name} ) to see an instance in InService..."
1616 IN_SERVICE=$( aws elb describe-instance-health \
1717 --load-balancer-name " ${elb_name} " \
18- --query ' InstanceStates[].State' \
19- | grep InService \
20- | wc -l)
18+ --query ' length(InstanceStates[?State==`InService`])' )
2119 done
2220}
2321
Original file line number Diff line number Diff line change @@ -122,28 +122,27 @@ aws ec2 describe-instances \
122122 $EXTRA_AWS_CLI_ARGS
123123
124124# get ELB public DNS name through cloudformation
125- # TODO: is "first output value" going to be reliable enough?
126125export ELB_DNS_NAME=$( aws cloudformation describe-stacks \
127126 --stack-name $STACK_NAME \
128127 --max-items 1 \
129- --query ' Stacks[].[ Outputs[0].[ OutputValue ] ]' \
128+ --query ' Stacks[].[ Outputs[?OutputKey==`DNSName`]. OutputValue ] ]' \
130129 --output=text \
131130 $EXTRA_AWS_CLI_ARGS )
132131
133132# get ELB friendly name through aws elb
134133ELB_NAME=$( aws elb describe-load-balancers \
135- --query ' LoadBalancerDescriptions[].[ DNSName, LoadBalancerName ]' \
134+ --query " LoadBalancerDescriptions[?DNSName==' $ELB_DNS_NAME ' ].[ LoadBalancerName ]" \
136135 --output=text \
137- $EXTRA_AWS_CLI_ARGS | grep -F $ELB_DNS_NAME | head -n1 | cut -f2 )
136+ $EXTRA_AWS_CLI_ARGS )
138137echo " Using ELB $ELB_NAME at $ELB_DNS_NAME "
139138
140139# Instance launched into a VPC may not have a PublicIPAddress
141140for ip_type in PublicIpAddress PrivateIpAddress; do
142141 FIRST_INSTANCE=$( aws ec2 describe-instances \
143142 --filters Name=tag:aws:cloudformation:stack-name,Values=$STACK_NAME Name=instance-state-name,Values=running \
144- --query " Reservations[].Instances[].[$ip_type ]" \
143+ --query " Reservations[].Instances[].[$ip_type ][0] " \
145144 --output text \
146- $EXTRA_AWS_CLI_ARGS | head -1 )
145+ $EXTRA_AWS_CLI_ARGS )
147146 if [[ ! $FIRST_INSTANCE == " None" ]]; then
148147 break
149148 fi
You can’t perform that action at this time.
0 commit comments