@@ -54,19 +54,31 @@ msg "Instance is not part of an ASG, continuing with ELB"
5454if [ -z " $ELB_LIST " ]; then
5555 error_exit " ELB_LIST is empty. Must have at least one load balancer to register to, or \" _all_\" , \" _any_\" values."
5656elif [ " ${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."
57+ if [ " $( get_flag " dereg" ) " = " true" ]; then
58+ msg " Finding all the ELBs that this instance was previously registered to"
59+ if ! ELB_LIST=$( get_flag " ELBs" ) ; then
60+ error_exit " $FLAGFILE doesn't exist or is unreadble"
61+ elif [ -z $ELB_LIST ]; then
62+ error_exit " Couldn't find any. Must have at least one load balancer to register to."
63+ fi
64+ else
65+ msg " Assuming this is the first deployment and ELB_LIST=_all_ so finishing successfully without registering."
66+ finish_msg
67+ exit 0
6268 fi
6369elif [ " ${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+ if [ " $( get_flag " dereg" ) " = " true" ]; then
71+ msg " Finding all the ELBs that this instance was previously registered to"
72+ if ! ELB_LIST=$( get_flag " ELBs" ) ; then
73+ error_exit " $FLAGFILE doesn't exist or is unreadble"
74+ elif [ -z $ELB_LIST ]; then
75+ msg " Couldn't find any, but ELB_LIST=_any_ so finishing successfully without registering."
76+ remove_flagfile
77+ finish_msg
78+ exit 0
79+ fi
80+ else
81+ msg " Assuming this is the first deployment and ELB_LIST=_any_ so finishing successfully without registering."
7082 finish_msg
7183 exit 0
7284 fi
0 commit comments