Method: Ufo::Cfn::Stack::Status#wait

Defined in:
lib/ufo/cfn/stack/status.rb

#waitObject

check for /(_COMPLETE|_FAILED)$/ status



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/ufo/cfn/stack/status.rb', line 45

def wait
  start_time = Time.now

  refresh_events
  until completed || @stack_deletion_completed
    show_events
  end
  show_events(true) # show the final event

  if @stack_deletion_completed
    puts "Stack #{@stack_name} deleted."
    return
  end

  if last_event_status =~ /_FAILED/
    puts "Stack failed: #{last_event_status}".color(:red)
    puts "Stack reason #{@events[0]["resource_status_reason"]}".color(:red)
  elsif last_event_status =~ /_ROLLBACK_/
    puts "Stack rolled back: #{last_event_status}".color(:red)
  else # success
    puts "Stack success status: #{last_event_status}".color(:green)
  end

  return if @hide_time_took
  took = Time.now - start_time
  puts "Time took for stack deployment: #{pretty_time(took).color(:green)}."
end