kumogata 0.3.1 → 0.3.2

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: 8cd791918735e1907810108f2184648fbe339a32
4
- data.tar.gz: 9c2ed98e5d0201914999e0b155556ca07d313f87
3
+ metadata.gz: baf7b8cbddd815d7f08705918dcb9bba0f426345
4
+ data.tar.gz: d8df685f3891d4266da07997a2926a4a33083dfc
5
5
  SHA512:
6
- metadata.gz: 81a59fa806d0922995d8f2e1947656230b333d009af5c3011566511e50dac80e3735e7886c8812c9372a89f44af5a5e662fdbcc4606fd6cd030a815136463040
7
- data.tar.gz: 75fa198f417eb52c44543e1bd4f30fb12d670b3e3b303fa7526429f0d1beadad00680b64ac3b7a4dc34b8eba5f976aee928d5da44134d3cd2736065dc2df9a49
6
+ metadata.gz: 7b36d2411bdd49f4b2031efa2c45fd4f8fbd30591857c85098b1f004805b6e5cbe6615fccbfa998cc5e62becd5bd3a2324adbaf211848df68c19f7341097da94
7
+ data.tar.gz: 0ad0e636569b330cb22849a41c2728c0b2419767d170e26225633069274b6cdb0b01a00be168003e2f066bbf4bd02ba2a5eb90362be0f61975115196aeb9908c
data/README.md CHANGED
@@ -5,8 +5,8 @@
5
5
 
6
6
  Kumogata is a tool for [AWS CloudFormation](https://aws.amazon.com/cloudformation/).
7
7
 
8
- [![Gem Version](https://badge.fury.io/rb/kumogata.png?201403080125)](http://badge.fury.io/rb/kumogata)
9
- [![Build Status](https://drone.io/github.com/winebarrel/kumogata/status.png?201403080125)](https://drone.io/github.com/winebarrel/kumogata/latest)
8
+ [![Gem Version](https://badge.fury.io/rb/kumogata.png?201403082134)](http://badge.fury.io/rb/kumogata)
9
+ [![Build Status](https://drone.io/github.com/winebarrel/kumogata/status.png?201403082134)](https://drone.io/github.com/winebarrel/kumogata/latest)
10
10
 
11
11
  It can define a template in Ruby DSL, such as:
12
12
 
@@ -81,7 +81,7 @@ Options:
81
81
  -s, --secret-key SECRET_KEY
82
82
  -r, --region REGION
83
83
  --skip-replace-underscore
84
- --skip-delete-stack
84
+ --deletion-policy-retain
85
85
  -p, --parameters KEY_VALUES
86
86
  -e, --encrypt-parameters KEYS
87
87
  --encryption-password PASS
@@ -80,7 +80,7 @@ class Kumogata::ArgumentParser
80
80
  opt.on('-s', '--secret-key SECRET_KEY') {|v| options[:secret_access_key] = v }
81
81
  opt.on('-r', '--region REGION') {|v| options[:region] = v }
82
82
  opt.on('' , '--skip-replace-underscore') { options[:replace_underscore] = false }
83
- opt.on('' , '--skip-delete-stack') { options[:delete_stack] = false }
83
+ opt.on('' , '--deletion-policy-retain') { options[:deletion_policy_retain] = true }
84
84
  opt.on('-p', '--parameters KEY_VALUES', Array) {|v| options[:parameters] = v }
85
85
  opt.on('-e', '--encrypt-parameters KEYS', Array) {|v| options[:encrypt_parameters] = v }
86
86
  opt.on('', '--encryption-password PASS') {|v| options[:encryption_password] = v }
@@ -375,7 +375,7 @@ class Kumogata::Client
375
375
  end
376
376
 
377
377
  def update_deletion_policy(template)
378
- if @options.delete_stack?
378
+ if @options.delete_stack? or @options.deletion_policy_retain?
379
379
  template['Resources'].each do |k, v|
380
380
  v['DeletionPolicy'] = 'Retain'
381
381
  end
@@ -1,3 +1,3 @@
1
1
  module Kumogata
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
@@ -178,6 +178,61 @@ end
178
178
  end
179
179
  end
180
180
 
181
+ it 'create a stack from Ruby template with deletion policy retain' do
182
+ template = <<-EOS
183
+ Resources do
184
+ myEC2Instance do
185
+ Type "AWS::EC2::Instance"
186
+ Properties do
187
+ ImageId "ami-XXXXXXXX"
188
+ InstanceType "t1.micro"
189
+ end
190
+ end
191
+ end
192
+
193
+ Outputs do
194
+ AZ do
195
+ Value do
196
+ Fn__GetAtt "myEC2Instance", "AvailabilityZone"
197
+ end
198
+ end
199
+ end
200
+ EOS
201
+
202
+ run_client(:create, :arguments => ['MyStack'], :template => template, :options => {:deletion_policy_retain => true}) do |client, cf|
203
+ json = eval_template(template, :update_deletion_policy => true).to_json
204
+
205
+ output = make_double('output') do |obj|
206
+ obj.should_receive(:key) { 'AZ' }
207
+ obj.should_receive(:value) { 'ap-northeast-1b' }
208
+ end
209
+
210
+ resource_summary = make_double('resource_summary') do |obj|
211
+ obj.should_receive(:[]).with(:logical_resource_id) { 'myEC2Instance' }
212
+ obj.should_receive(:[]).with(:physical_resource_id) { 'i-XXXXXXXX' }
213
+ obj.should_receive(:[]).with(:resource_type) { 'AWS::EC2::Instance' }
214
+ obj.should_receive(:[]).with(:resource_status) { 'CREATE_COMPLETE' }
215
+ obj.should_receive(:[]).with(:resource_status_reason) { nil }
216
+ obj.should_receive(:[]).with(:last_updated_timestamp) { '2014-03-02 04:35:12 UTC' }
217
+ end
218
+
219
+ stack = make_double('stack') do |obj|
220
+ obj.should_receive(:status).and_return(
221
+ 'CREATE_COMPLETE',
222
+ 'CREATE_COMPLETE')
223
+ obj.should_receive(:outputs) { [output] }
224
+ obj.should_receive(:resource_summaries) { [resource_summary] }
225
+ end
226
+
227
+ stacks = make_double('status') do |obj|
228
+ obj.should_receive(:create)
229
+ .with('MyStack', json, {}) { stack }
230
+ end
231
+
232
+ cf.should_receive(:stacks) { stacks }
233
+ end
234
+ end
235
+
181
236
  it 'create a stack from Ruby template with invalid stack name' do
182
237
  template = <<-EOS
183
238
  Resources do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kumogata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-07 00:00:00.000000000 Z
11
+ date: 2014-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk