lib/zergrush_cf/init.rb in zergrush_cf-0.0.12 vs lib/zergrush_cf/init.rb in zergrush_cf-0.0.13

- old
+ new

@@ -207,11 +207,12 @@ # get the event collection and initial info outputs_info = nil while outputs_info == nil do sleep 3 - outputs_info = cf.describe_stacks({ 'StackName' => stack_name }) + with_retries(:max_tries => 10, :base_sleep_seconds => 3, :max_sleep_seconds => 20) { + outputs_info = cf.describe_stacks({ 'StackName' => stack_name }) begin outputs_info = cf.describe_stacks({ 'StackName' => stack_name }) rescue Fog::AWS::CloudFormation::NotFound rabbit_objects[:connection].close unless rabbit_objects == nil return 0 @@ -223,17 +224,17 @@ with_retries(:max_tries => 10, :base_sleep_seconds => 3, :max_sleep_seconds => 20) { events = cf.describe_stack_events(stack_name).body['StackEvents'] } while events == nil do sleep 3 - begin - with_retries(:max_tries => 10, :base_sleep_seconds => 3, :max_sleep_seconds => 20) { + with_retries(:max_tries => 10, :base_sleep_seconds => 3, :max_sleep_seconds => 20) { + begin events = cf.describe_stack_events(stack_name).body['StackEvents'] - } - rescue Fog::AWS::CloudFormation::NotFound - rabbit_objects[:connection].close unless rabbit_objects == nil - return 0 - end + rescue Fog::AWS::CloudFormation::NotFound + rabbit_objects[:connection].close unless rabbit_objects == nil + return 0 + end + } end event_counter = 0 while outputs_info.body["Stacks"][0]["StackStatus"] == "DELETE_IN_PROGRESS" do logEvents(events.first(events.length - event_counter))