stackup 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b649897af4dba63a33163c2c265e71e3883b73c
4
- data.tar.gz: fb24cad02b8e50e5f7ee2f6411b7faa64cc18d3e
3
+ metadata.gz: 72ac043517d513f34ee9d26b0575dd09490244d3
4
+ data.tar.gz: a7964f8761f674eadc3dbd9bef961f3761e9b964
5
5
  SHA512:
6
- metadata.gz: 68f9c58d118c8d766c4e2837bf8c0846fe08f240dbedf583d30fe3637554bbfa23efe320239ea29a5d8eb84b9890982ff6dac852ccdbcae437efc37da531e802
7
- data.tar.gz: cf8dde6a511662558fc0a0a77f6ded5dc5d4d978c9e83c729f4b1fb80f3f59ec6165e952f17beb46279c0e0a55fa77c14b5a34b68dd3a48f96d5834036afe09c
6
+ metadata.gz: a1b6073edf68ff4dd0a75ed31e73787fbd549c2523370eaf1b4c51fd07bbeb5a21e524edc75f1a898b98389af462af28286b3022b9cd12dfbf915c2d27d32362
7
+ data.tar.gz: 252fc02edab1de1d593b840238e28d10e59427a5a32d119ee50dad819aa614d4b989ecb3bd0f3b8c80abed6888ad285ed032d208ab3d13cf9f33a660bfcdbaab
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stackup (0.4.0)
4
+ stackup (0.5.0)
5
5
  aws-sdk (~> 2.0)
6
6
  clamp (~> 1.0)
7
7
  console_logger
data/bin/stackup CHANGED
@@ -4,8 +4,9 @@ $LOAD_PATH << File.expand_path("../../lib", __FILE__)
4
4
 
5
5
  require "clamp"
6
6
  require "console_logger"
7
- require "stackup"
8
7
  require "multi_json"
8
+ require "stackup"
9
+ require "stackup/version"
9
10
  require "yaml"
10
11
 
11
12
  Clamp do
@@ -19,6 +20,11 @@ Clamp do
19
20
 
20
21
  option "--debug", :flag, "enable debugging"
21
22
 
23
+ option ["--version"], :flag, "display version" do
24
+ puts "stackup v#{Stackup::VERSION}"
25
+ exit 0
26
+ end
27
+
22
28
  parameter "NAME", "Name of stack", :attribute_name => :stack_name
23
29
 
24
30
  def run(arguments)
@@ -147,6 +153,56 @@ Clamp do
147
153
 
148
154
  end
149
155
 
156
+ subcommand "events", "List stack events" do
157
+
158
+ option ["-f", "--follow"], :flag, "follow new events"
159
+ option ["--data"], :flag, "display events as data"
160
+
161
+ def execute
162
+ stack.watch(false) do |watcher|
163
+ loop do
164
+ watcher.each_new_event do |event|
165
+ display_event(event)
166
+ end
167
+ break unless follow?
168
+ sleep 5
169
+ end
170
+ end
171
+ end
172
+
173
+ private
174
+
175
+ def display_event(e)
176
+ if data?
177
+ display_data(event_data(e))
178
+ else
179
+ puts event_summary(e)
180
+ end
181
+ end
182
+
183
+ def event_data(e)
184
+ {
185
+ "timestamp" => e.timestamp.localtime,
186
+ "logical_resource_id" => e.logical_resource_id,
187
+ "physical_resource_id" => e.physical_resource_id,
188
+ "resource_status" => e.resource_status,
189
+ "resource_status_reason" => e.resource_status_reason
190
+ }.reject { |_k, v| blank?(v) }
191
+ end
192
+
193
+ def blank?(v)
194
+ v.nil? || v.respond_to?(:empty?) && v.empty?
195
+ end
196
+
197
+ def event_summary(e)
198
+ summary = "[#{e.timestamp.localtime.iso8601}] #{e.logical_resource_id}"
199
+ summary += " - #{e.resource_status}"
200
+ summary += " - #{e.resource_status_reason}" if e.resource_status_reason
201
+ summary
202
+ end
203
+
204
+ end
205
+
150
206
  subcommand "template", "Display stack template." do
151
207
 
152
208
  def execute
data/lib/stackup/stack.rb CHANGED
@@ -228,6 +228,12 @@ module Stackup
228
228
  end
229
229
  end
230
230
 
231
+ def watch(zero = true)
232
+ watcher = Stackup::StackWatcher.new(cf_stack)
233
+ watcher.zero if zero
234
+ yield watcher
235
+ end
236
+
231
237
  private
232
238
 
233
239
  attr_reader :cf_client
@@ -282,17 +288,17 @@ module Stackup
282
288
  # @return the final stack status
283
289
  #
284
290
  def modify_stack
285
- watcher = Stackup::StackWatcher.new(cf_stack)
286
- watcher.zero
287
- handling_validation_error do
288
- yield
289
- end
290
- loop do
291
- watcher.each_new_event(&event_handler)
292
- status = self.status
293
- logger.debug("stack_status=#{status}")
294
- return status if status.nil? || status =~ /_(COMPLETE|FAILED)$/
295
- sleep(5)
291
+ watch do |watcher|
292
+ handling_validation_error do
293
+ yield
294
+ end
295
+ loop do
296
+ watcher.each_new_event(&event_handler)
297
+ status = self.status
298
+ logger.debug("stack_status=#{status}")
299
+ return status if status.nil? || status =~ /_(COMPLETE|FAILED)$/
300
+ sleep(5)
301
+ end
296
302
  end
297
303
  end
298
304
 
@@ -0,0 +1,5 @@
1
+ module Stackup
2
+
3
+ VERSION = "0.5.0"
4
+
5
+ end
Binary file
data/stackup.gemspec CHANGED
@@ -1,10 +1,12 @@
1
1
  lib = File.expand_path("../lib", __FILE__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
+ require "stackup/version"
5
+
4
6
  Gem::Specification.new do |spec|
5
7
 
6
8
  spec.name = "stackup"
7
- spec.version = "0.4.0"
9
+ spec.version = Stackup::VERSION
8
10
  spec.authors = ["Mike Williams", "Arvind Kunday"]
9
11
  spec.email = ["mike.williams@rea-group.com", "arvind.kunday@rea-group.com"]
10
12
  spec.summary = "Manage CloudFormation stacks"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stackup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Williams
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-11 00:00:00.000000000 Z
12
+ date: 2015-10-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk
@@ -111,8 +111,10 @@ files:
111
111
  - lib/stackup/service.rb
112
112
  - lib/stackup/stack.rb
113
113
  - lib/stackup/stack_watcher.rb
114
+ - lib/stackup/version.rb
114
115
  - pkg/stackup-0.2.0.gem
115
116
  - pkg/stackup-0.3.0.gem
117
+ - pkg/stackup-0.4.0.gem
116
118
  - spec/spec_helper.rb
117
119
  - spec/stackup/stack_spec.rb
118
120
  - spec/stackup/stack_watcher_spec.rb