@@ -11,7 +11,7 @@ function spinDownASGs() {
1111 console . log ( `Found the following ${ stoppableASGs . length } instances to spin down...` ) ;
1212 if ( stoppableASGs . length === 0 ) {
1313 console . log ( 'None! Moving on.' ) ;
14- return 'No ASGs to spin down' ;
14+ return [ ] ;
1515 }
1616
1717 stoppableASGs . forEach ( ( asg ) => {
@@ -20,8 +20,10 @@ function spinDownASGs() {
2020 return tagASGs ( stoppableASGs ) ;
2121 } )
2222 . then ( ( taggedASGs ) => {
23- console . log ( `Finished tagging ASGs. Moving on to spin down ${ taggedASGs . length } of them.` ) ;
24- return stopASGs ( taggedASGs ) ;
23+ if ( taggedASGs . length > 0 ) {
24+ console . log ( `Finished tagging ASGs. Moving on to spin down ${ taggedASGs . length } of them.` ) ;
25+ return stopASGs ( taggedASGs ) ;
26+ }
2527 } ) ;
2628}
2729
@@ -31,7 +33,7 @@ function stopAllInstances() {
3133 console . log ( 'Found the following instances to shut down...' ) ;
3234 if ( stoppableInstances . length === 0 ) {
3335 console . log ( 'None! Moving on.' ) ;
34- return 'No instances to shut down' ;
36+ return [ ] ;
3537 }
3638
3739 stoppableInstances . forEach ( ( instance ) => {
@@ -40,8 +42,10 @@ function stopAllInstances() {
4042 return tagInstances ( stoppableInstances ) ;
4143 } )
4244 . then ( ( taggedInstances ) => {
43- console . log ( 'Finished tagging instances. Moving on to stop them.' ) ;
44- return stopInstances ( taggedInstances ) ;
45+ if ( taggedInstances . length > 0 ) {
46+ console . log ( 'Finished tagging instances. Moving on to stop them.' ) ;
47+ return stopInstances ( taggedInstances ) ;
48+ }
4549 } ) ;
4650}
4751
0 commit comments