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 @@ -121,28 +121,27 @@ aws ec2 describe-instances \
121121 $EXTRA_AWS_CLI_ARGS
122122
123123# get ELB public DNS name through cloudformation
124- # TODO: is "first output value" going to be reliable enough?
125124export ELB_DNS_NAME=$( aws cloudformation describe-stacks \
126125 --stack-name $STACK_NAME \
127126 --max-items 1 \
128- --query ' Stacks[].[ Outputs[0].[ OutputValue ] ]' \
127+ --query ' Stacks[].[ Outputs[?OutputKey==`DNSName`]. OutputValue ] ]' \
129128 --output=text \
130129 $EXTRA_AWS_CLI_ARGS )
131130
132131# get ELB friendly name through aws elb
133132ELB_NAME=$( aws elb describe-load-balancers \
134- --query ' LoadBalancerDescriptions[].[ DNSName, LoadBalancerName ]' \
133+ --query " LoadBalancerDescriptions[?DNSName==' $ELB_DNS_NAME ' ].[ LoadBalancerName ]" \
135134 --output=text \
136- $EXTRA_AWS_CLI_ARGS | grep -F $ELB_DNS_NAME | head -n1 | cut -f2 )
135+ $EXTRA_AWS_CLI_ARGS )
137136echo " Using ELB $ELB_NAME at $ELB_DNS_NAME "
138137
139138# Instance launched into a VPC may not have a PublicIPAddress
140139for ip_type in PublicIpAddress PrivateIpAddress; do
141140 FIRST_INSTANCE=$( aws ec2 describe-instances \
142141 --filters Name=tag:aws:cloudformation:stack-name,Values=$STACK_NAME Name=instance-state-name,Values=running \
143- --query " Reservations[].Instances[].[$ip_type ]" \
142+ --query " Reservations[].Instances[].[$ip_type ][0] " \
144143 --output text \
145- $EXTRA_AWS_CLI_ARGS | head -1 )
144+ $EXTRA_AWS_CLI_ARGS )
146145 if [[ ! $FIRST_INSTANCE == " None" ]]; then
147146 break
148147 fi
You can’t perform that action at this time.
0 commit comments