@@ -235,7 +235,7 @@ autoscaling_group_name() {
235235 local autoscaling_name=$( $AWS_CLI autoscaling describe-auto-scaling-instances \
236236 --instance-ids $instance_id \
237237 --output text \
238- --query AutoScalingInstances[0].AutoScalingGroupName)
238+ --query AutoScalingInstances[0].AutoScalingGroupName | tr -d ' \n\r ' )
239239
240240 if [ $? != 0 ]; then
241241 return 1
@@ -342,7 +342,7 @@ autoscaling_enter_standby() {
342342# successful.
343343autoscaling_exit_standby () {
344344 local instance_id=$1
345- local asg_name=${2}
345+ local asg_name=${2}
346346
347347 msg " Checking if this instance has already been moved out of Standby state"
348348 local instance_state=$( get_instance_state_asg $instance_id )
@@ -365,6 +365,7 @@ autoscaling_exit_standby() {
365365 $AWS_CLI autoscaling exit-standby \
366366 --instance-ids $instance_id \
367367 --auto-scaling-group-name \" ${asg_name} \"
368+
368369 if [ $? != 0 ]; then
369370 msg " Failed to put instance $instance_id back into InService for ASG ${asg_name} ."
370371 return 1
@@ -501,7 +502,7 @@ wait_for_state() {
501502
502503 msg " Checking $WAITER_ATTEMPTS times, every $WAITER_INTERVAL seconds, for instance $instance_id to be in state $state_name "
503504
504- local instance_state=$( $instance_state_cmd )
505+ local instance_state=$( $instance_state_cmd | tr -d ' \n\r ' )
505506 local count=1
506507
507508 msg " Instance is currently in state: $instance_state "
@@ -514,7 +515,7 @@ wait_for_state() {
514515
515516 sleep $WAITER_INTERVAL
516517
517- instance_state=$( $instance_state_cmd )
518+ instance_state=$( $instance_state_cmd | tr -d ' \n\r ' )
518519 count=$(( $count + 1 ))
519520 msg " Instance is currently in state: $instance_state "
520521 done
0 commit comments