autostacker24 1.0.41 → 1.0.42

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/autostacker24/stacker.rb +16 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a4f0d76f561b986df8b2af5fa464b634c6b8ba0d
4
- data.tar.gz: e11ad369e90c274c0fb47d6f55f0270b58e80509
3
+ metadata.gz: 6a0b18224e1a9cf2044914d69fbc27d7e1633cbf
4
+ data.tar.gz: 23809d1e229d11f182c7d6b6b99de91e6e8385a9
5
5
  SHA512:
6
- metadata.gz: c7a9245207abefb4b1a468668fab9d4ba416af9e152d49a63d11ba0d77805f477dd968b66684e2f0c426223c9c4597071bf00d6a12b9eace58feefbb3cf44e30
7
- data.tar.gz: dbf24a05889a6877784b9ab348a8748c0390a2cc6b6a8a3be107c54f29c63a38b1ba3cf6dced0a06c71f81fad282319ded5e5644a2f8d895868d4513bad36eec
6
+ metadata.gz: a6595cc004225647cf56eaed70746f363819efc1c5a31814c60b719927cfab8d18754c74bdb2b2299d97c001f1c33cee68fe74c2f05501f0ca9890c640b03fe2
7
+ data.tar.gz: 3e778ee5ed4fdf9d9fac3b21e89663c2d95bb8df5252d2d88ac1368183712b6d072289cdf642cb1f611a661556a0908216a9097823b9156685313b2c21b91bc0
@@ -83,8 +83,12 @@ module Stacker
83
83
  end
84
84
 
85
85
  def wait_for_stack(stack_name, operation, timeout_in_minutes = 15)
86
- stop_time = Time.now + timeout_in_minutes * 60
87
- finished = /(CREATE_COMPLETE|UPDATE_COMPLETE|DELETE_COMPLETE|ROLLBACK_COMPLETE|ROLLBACK_FAILED|CREATE_FAILED|DELETE_FAILED)$/
86
+ start_time = Time.now
87
+ stop_time = Time.now + timeout_in_minutes * 60
88
+ finished = /(CREATE_COMPLETE|UPDATE_COMPLETE|DELETE_COMPLETE|ROLLBACK_COMPLETE|ROLLBACK_FAILED|CREATE_FAILED|DELETE_FAILED)$/
89
+ seen_events = Array.new
90
+
91
+ puts "waiting for #{operation} stack #{stack_name}"
88
92
  while Time.now < stop_time
89
93
  stack = find_stack(stack_name)
90
94
  status = stack ? stack.stack_status : 'DELETE_COMPLETE'
@@ -95,7 +99,12 @@ module Stacker
95
99
  end
96
100
  return true if status =~ expected_status
97
101
  raise "#{operation} #{stack_name} failed, current status #{status}" if status =~ finished
98
- puts "waiting for #{operation} stack #{stack_name}, current status #{status}"
102
+ get_stack_events(stack_name).select{ |e| e[:timestamp] > start_time && !seen_events.include?(e[:event_id]) }
103
+ .sort_by{|e| e[:timestamp]}
104
+ .each{·
105
+ |e| seen_events << e[:event_id]
106
+ puts "#{e[:timestamp]}\t#{e[:resource_status].ljust(20)}\t#{e[:resource_type].ljust(40)}\t#{e[:logical_resource_id].ljust(30)}\t#{e[:resource_status_reason]}"
107
+ }
99
108
  sleep(7)
100
109
  end
101
110
  raise "waiting for #{operation} stack #{stack_name} timed out after #{timeout_in_minutes} minutes"
@@ -144,6 +153,10 @@ module Stacker
144
153
  resources.inject({}){|map, resource| map.merge(resource.logical_resource_id.to_sym => resource)}.freeze
145
154
  end
146
155
 
156
+ def get_stack_events(stack_name)
157
+ events = cloud_formation.describe_stack_events(stack_name: stack_name).data.stack_events
158
+ end
159
+
147
160
  def cloud_formation # lazy CloudFormation client
148
161
  unless @lazy_cloud_formation
149
162
  params = {}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autostacker24
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.41
4
+ version: 1.0.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johannes Mueller
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-09 00:00:00.000000000 Z
12
+ date: 2015-02-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk-core