stack_master 0.16.0 → 0.17.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: d5d29ac1458d3d02d58c32fb317667305d2a6ca0
4
- data.tar.gz: 093812e92afeca3f64aa0db34999222c85161c7b
3
+ metadata.gz: 8db962bf4169a452e81cee1d7ece124096742f13
4
+ data.tar.gz: 865423915902223abcf444b3431b8db49c6011a7
5
5
  SHA512:
6
- metadata.gz: a2695db0d497f24a78f583b14377ff3f88869d055262696eca00c61d2ed111faa83801aaf1c5d9499e412c6c51c1c18ae2621188dd88180c361b27a07176f78c
7
- data.tar.gz: 53940ce6b011d5adbf44bf4c7f3ab0b9467101989eea7d23412198eac63caeb474ca1e95bc606b577588f70d114637f8d08749897494749b02a9468ecc159c28
6
+ metadata.gz: 79fa18d43b6e1b2db51f0376f481793b6604476cf4311e21505a3c9507569fa1834b5f036a782f679aa14cd5d7fbb2ca8811d846fed95a5e710b4d88b3893dd3
7
+ data.tar.gz: 1c9b305fcfae1a2705ade052e48f070468dcfe33852c2cc54ee153b3d6e9286e449f9d66c9d10e2cba2d2d54e4c65cf440af766366e03cae2e3735cf1da6299c
@@ -14,7 +14,7 @@ module StackMaster
14
14
 
15
15
  return unless check_exists
16
16
 
17
- unless ask?("Really delete stack (y/n)? ")
17
+ unless ask?("Really delete stack #{@stack_name} (y/n)? ")
18
18
  StackMaster.stdout.puts "Stack update aborted"
19
19
  return
20
20
  end
@@ -1,6 +1,8 @@
1
1
  module StackMaster
2
2
  module StackEvents
3
3
  class Streamer
4
+ StackFailed = Class.new(StandardError)
5
+
4
6
  def self.stream(*args, &block)
5
7
  new(*args, &block).stream
6
8
  end
@@ -24,6 +26,7 @@ module StackMaster
24
26
  @block.call(event) if @block
25
27
  Presenter.print_event(@io, event) if @io
26
28
  if @break_on_finish_state && finish_state?(event)
29
+ exit_with_error(event) if failure_state?(event)
27
30
  throw :halt
28
31
  end
29
32
  end
@@ -50,6 +53,16 @@ module StackMaster
50
53
  event.resource_type == 'AWS::CloudFormation::Stack' &&
51
54
  event.logical_resource_id == @stack_name
52
55
  end
56
+
57
+ def failure_state?(event)
58
+ StackStates.failure_state?(event.resource_status) &&
59
+ event.resource_type == 'AWS::CloudFormation::Stack' &&
60
+ event.logical_resource_id == @stack_name
61
+ end
62
+
63
+ def exit_with_error(event)
64
+ raise StackFailed, "#{event.logical_resource_id} did not succeed (last state was #{event.resource_status})"
65
+ end
53
66
  end
54
67
  end
55
68
  end
@@ -1,3 +1,3 @@
1
1
  module StackMaster
2
- VERSION = "0.16.0"
2
+ VERSION = "0.17.0"
3
3
  end
@@ -30,4 +30,18 @@ RSpec.describe StackMaster::StackEvents::Streamer do
30
30
  StackMaster::StackEvents::Streamer.stream(stack_name, region, sleep_between_fetches: 0, io: io)
31
31
  expect(io.string).to include('UPDATE_COMPLETE')
32
32
  end
33
+
34
+ context "the stack is in a failed state" do
35
+ let(:events_second_call) {
36
+ events_first_call + [
37
+ OpenStruct.new(event_id: '4', resource_status: 'ROLLBACK_FAILED', resource_type: 'AWS::CloudFormation::Stack', logical_resource_id: stack_name, timestamp: Time.now)
38
+ ]
39
+ }
40
+
41
+ it 'raises an error on failure' do
42
+ expect {
43
+ StackMaster::StackEvents::Streamer.stream(stack_name, region, sleep_between_fetches: 0)
44
+ }.to raise_error(StackMaster::StackEvents::Streamer::StackFailed)
45
+ end
46
+ end
33
47
  end
data/stack_master.gemspec CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency "timecop"
29
29
  spec.add_dependency "ruby-progressbar"
30
30
  spec.add_dependency "commander"
31
- spec.add_dependency "aws-sdk", "~> 2.6.26"
31
+ spec.add_dependency "aws-sdk", "~> 2.6"
32
32
  spec.add_dependency "diffy"
33
33
  spec.add_dependency "erubis"
34
34
  spec.add_dependency "colorize"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stack_master
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Hodgkiss
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-05-17 00:00:00.000000000 Z
12
+ date: 2017-08-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -143,14 +143,14 @@ dependencies:
143
143
  requirements:
144
144
  - - "~>"
145
145
  - !ruby/object:Gem::Version
146
- version: 2.6.26
146
+ version: '2.6'
147
147
  type: :runtime
148
148
  prerelease: false
149
149
  version_requirements: !ruby/object:Gem::Requirement
150
150
  requirements:
151
151
  - - "~>"
152
152
  - !ruby/object:Gem::Version
153
- version: 2.6.26
153
+ version: '2.6'
154
154
  - !ruby/object:Gem::Dependency
155
155
  name: diffy
156
156
  requirement: !ruby/object:Gem::Requirement
@@ -450,7 +450,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
450
450
  version: '0'
451
451
  requirements: []
452
452
  rubyforge_project:
453
- rubygems_version: 2.6.8
453
+ rubygems_version: 2.6.11
454
454
  signing_key:
455
455
  specification_version: 4
456
456
  summary: StackMaster is a sure-footed way of creating, updating and keeping track