stack_master 1.0.0 → 1.0.1

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: bf6c29e375676d2bbd7d93ac50eb49a2f9d34088
4
- data.tar.gz: ddf038345eb4034700624804f7ca01621f7c1bb9
3
+ metadata.gz: d2df973e8c51854049665bee6f11cff19b8a7aba
4
+ data.tar.gz: 2ce1a8f1de5d06e02a47aef292648d79c2c52d21
5
5
  SHA512:
6
- metadata.gz: dca5b26f38caa092166b30f2fb0210388f417feff5d2fec3236440fc7d8600d0513038dc26c2f36601b4e65e762ca2e3c4d3b6168e0fd017009e1d144f5517db
7
- data.tar.gz: '098d941af23edcf79dc0baa78bf64b4eb58c0355c651c33f163cfb4e0bf5589e6e1215516cdee6f36dc922c71dc6415e04078b7ae611a321e26dafe6c7fa1466'
6
+ metadata.gz: 869faae3d938ae4cee9e9e666c25077a308220eaa7544fb8a9e78aeeb6df9870df541871102651a3c45efef0f1258490b50be49f48f6bf68d733e5a57001e85e
7
+ data.tar.gz: b2958b04187ad83dea0e22909f07a66219214080ce097715d02a06775987dc0f86e86bd55482305e9cb8de59a86e4e02c371cab6834a6ff809cafcaec9280a16
@@ -76,13 +76,23 @@ module StackMaster
76
76
  end
77
77
 
78
78
  def create_stack_by_change_set
79
- @change_set = ChangeSet.create(stack_options.merge(change_set_type: 'CREATE'))
80
- halt!(@change_set.status_reason) if @change_set.failed?
81
- @change_set.display(StackMaster.stdout)
82
- unless ask?('Create stack (y/n)? ')
79
+ begin
80
+ @change_set = ChangeSet.create(stack_options.merge(change_set_type: 'CREATE'))
81
+ if @change_set.failed?
82
+ ChangeSet.delete(@change_set.id)
83
+ halt!(@change_set.status_reason)
84
+ end
85
+
86
+ @change_set.display(StackMaster.stdout)
87
+ unless ask?('Create stack (y/n)? ')
88
+ cf.delete_stack(stack_name: stack_name)
89
+ halt!('Stack creation aborted')
90
+ end
91
+ rescue StackMaster::CtrlC
83
92
  cf.delete_stack(stack_name: stack_name)
84
- halt!('Stack creation aborted')
93
+ raise
85
94
  end
95
+
86
96
  execute_change_set
87
97
  end
88
98
 
@@ -102,7 +112,11 @@ module StackMaster
102
112
  def update_stack
103
113
  upload_files
104
114
  @change_set = ChangeSet.create(stack_options)
105
- halt!(@change_set.status_reason) if @change_set.failed?
115
+ if @change_set.failed?
116
+ ChangeSet.delete(@change_set.id)
117
+ halt!(@change_set.status_reason)
118
+ end
119
+
106
120
  @change_set.display(StackMaster.stdout)
107
121
  unless ask?("Apply change set (y/n)? ")
108
122
  ChangeSet.delete(@change_set.id)
@@ -1,3 +1,3 @@
1
1
  module StackMaster
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -109,6 +109,7 @@ RSpec.describe StackMaster::Commands::Apply do
109
109
 
110
110
  context 'the changeset failed to create' do
111
111
  before do
112
+ allow(StackMaster::ChangeSet).to receive(:delete)
112
113
  allow(change_set).to receive(:failed?).and_return(true)
113
114
  allow(change_set).to receive(:status_reason).and_return('reason')
114
115
  end
@@ -222,6 +223,19 @@ RSpec.describe StackMaster::Commands::Apply do
222
223
  expect(StackMaster::ChangeSet).to_not have_received(:execute).with(change_set.id)
223
224
  end
224
225
  end
226
+
227
+ context 'user uses ctrl+c' do
228
+ before do
229
+ allow(StackMaster).to receive(:non_interactive_answer).and_return('n')
230
+ allow(cf).to receive(:delete_stack)
231
+ allow(StackMaster::ChangeSet).to receive(:create).and_raise(StackMaster::CtrlC)
232
+ end
233
+
234
+ it "deletes the stack" do
235
+ expect(cf).to receive(:delete_stack).with(stack_name: stack_name)
236
+ expect { apply }.to raise_error
237
+ end
238
+ end
225
239
  end
226
240
 
227
241
  context 'one or more parameters are empty' do
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: 1.0.0
4
+ version: 1.0.1
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-12-11 00:00:00.000000000 Z
12
+ date: 2017-12-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler