@@ -49,11 +49,27 @@ if [ $? == 0 -a -n "${asg}" ]; then
4949 fi
5050fi
5151
52- msg " Instance is not part of an ASG, continuing... "
52+ msg " Instance is not part of an ASG, continuing with ELB "
5353
54- msg " Checking that user set at least one load balancer"
55- if test -z " $ELB_LIST " ; then
56- error_exit " Must have at least one load balancer to register to"
54+ if [ -z " $ELB_LIST " ]; then
55+ error_exit " ELB_LIST is empty. Must have at least one load balancer to register to, or \" _all_\" , \" _any_\" values."
56+ elif [ " ${ELB_LIST} " = " _all_" ]; then
57+ msg " Finding all the ELBs that this instance was previously registered to"
58+ if ! ELB_LIST=$( get_flag " ELBs" ) ; then
59+ error_exit " $FLAGFILE doesn't exist or is unreadble"
60+ elif [ -z $ELB_LIST ]; then
61+ error_exit " Couldn't find any. Must have at least one load balancer to register to."
62+ fi
63+ elif [ " ${ELB_LIST} " = " _any_" ]; then
64+ msg " Finding all the ELBs that this instance was previously registered to"
65+ if ! ELB_LIST=$( get_flag " ELBs" ) ; then
66+ error_exit " $FLAGFILE doesn't exist or is unreadble"
67+ elif [ -z $ELB_LIST ]; then
68+ msg " Couldn't find any, but ELB_LIST=any so finishing successfully without registering."
69+ remove_flagfile
70+ finish_msg
71+ exit 0
72+ fi
5773fi
5874
5975# Loop through all LBs the user set, and attempt to register this instance to them.
@@ -73,7 +89,7 @@ for elb in $ELB_LIST; do
7389 fi
7490done
7591
76- # Wait for all Registrations to finish
92+ # Wait for all registrations to finish
7793msg " Waiting for instance to register to its load balancers"
7894for elb in $ELB_LIST ; do
7995 wait_for_state " elb" $INSTANCE_ID " InService" $elb
@@ -82,4 +98,6 @@ for elb in $ELB_LIST; do
8298 fi
8399done
84100
101+ remove_flagfile
102+
85103finish_msg
0 commit comments