kumo_keisei 3.1.1.pre.alpha1 → 3.1.1.pre.alpha3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/kumo_keisei/stack.rb +5 -2
- data/spec/lib/kumo_keisei/stack_spec.rb +43 -35
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 346086261310a8b9fa14843b8da22adc19a081cc
|
4
|
+
data.tar.gz: 777605345884ba91408ba1393a55bdbe21855369
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f884c7a3b0aacffcf066d9c6813d75f762e035f644d5663c4df888a8b1b13f9a551addfbdff0f57ffd658b7d3928f380381a0cde8e708f34a056d6b1dd22c28
|
7
|
+
data.tar.gz: 7a6d328f28cee089cd11c4aeeea81fc18a7d2f4933842c383c536adfc7fb4dba1f4837c72fbbdadb91f7a833c7421cf2a533cc190632709f83f444702a4caf0c
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.1-
|
1
|
+
3.1.1-alpha3
|
data/lib/kumo_keisei/stack.rb
CHANGED
@@ -85,6 +85,10 @@ module KumoKeisei
|
|
85
85
|
environment_config(stack_config).config
|
86
86
|
end
|
87
87
|
|
88
|
+
def params_template_path(stack_config)
|
89
|
+
stack_config.has_key?(:template_path) ? File.absolute_path("#{File.basename(stack_config[:template_path], '.*')}.yml.erb") : nil
|
90
|
+
end
|
91
|
+
|
88
92
|
private
|
89
93
|
|
90
94
|
def transform_logical_resource_id(id)
|
@@ -162,8 +166,7 @@ module KumoKeisei
|
|
162
166
|
end
|
163
167
|
|
164
168
|
def environment_config(stack_config)
|
165
|
-
|
166
|
-
EnvironmentConfig.new(stack_config.merge(params_template_file_path: params_template_path))
|
169
|
+
EnvironmentConfig.new(stack_config.merge(params_template_file_path: params_template_path(stack_config)))
|
167
170
|
end
|
168
171
|
|
169
172
|
def stack_events_url
|
@@ -11,8 +11,9 @@ describe KumoKeisei::Stack do
|
|
11
11
|
let(:app_name) { "my-stack" }
|
12
12
|
let(:environment_name) { 'non-production' }
|
13
13
|
let(:stack_name) { "#{app_name}-nodes-#{environment_name}" }
|
14
|
-
let(:
|
15
|
-
let(:
|
14
|
+
let(:stack_template_name) { "#{app_name}-#{environment_name}" }
|
15
|
+
let(:stack_cfntemplate_filename) { "#{stack_template_name}.json" }
|
16
|
+
let(:stack_cfnparams_filename) { "#{stack_template_name}.yml.erb" }
|
16
17
|
let(:cloudformation) { instance_double(Aws::CloudFormation::Client) }
|
17
18
|
let(:happy_stack_status) { "CREATE_COMPLETE" }
|
18
19
|
let(:cf_stack) { stack_result_list_with_status(happy_stack_status, stack_name) }
|
@@ -34,7 +35,7 @@ describe KumoKeisei::Stack do
|
|
34
35
|
let(:stack_config) {
|
35
36
|
{
|
36
37
|
config_path: 'config-path',
|
37
|
-
template_path:
|
38
|
+
template_path: stack_cfntemplate_filename,
|
38
39
|
injected_config: { 'VpcId' => 'vpc-id' },
|
39
40
|
env_name: 'non-production'
|
40
41
|
}
|
@@ -49,9 +50,10 @@ describe KumoKeisei::Stack do
|
|
49
50
|
allow(Aws::CloudFormation::Client).to receive(:new).and_return(cloudformation)
|
50
51
|
allow(cloudformation).to receive(:describe_stacks).with({stack_name: stack_name}).and_return(cf_stack)
|
51
52
|
allow(KumoKeisei::ParameterBuilder).to receive(:new).and_return(parameter_builder)
|
52
|
-
allow(File).to receive(:read).with(
|
53
|
-
allow(KumoKeisei::EnvironmentConfig).to receive(:new).with(stack_config.merge(params_template_file_path: "
|
54
|
-
allow(File).to receive(:absolute_path).and_return("#{app_name}.yml.erb")
|
53
|
+
allow(File).to receive(:read).with(stack_cfntemplate_filename).and_return(stack_template_body)
|
54
|
+
allow(KumoKeisei::EnvironmentConfig).to receive(:new).with(stack_config.merge(params_template_file_path: "/#{stack_cfnparams_filename}")).and_return(double(:environment_config, cf_params: {}))
|
55
|
+
# allow(File).to receive(:absolute_path).and_return("#{app_name}.yml.erb")
|
56
|
+
Dir.chdir('/')
|
55
57
|
end
|
56
58
|
|
57
59
|
describe "#destroy!" do
|
@@ -89,27 +91,6 @@ describe KumoKeisei::Stack do
|
|
89
91
|
end
|
90
92
|
end
|
91
93
|
|
92
|
-
context "when looking for the parameter template file" do
|
93
|
-
before do
|
94
|
-
allow(cloudformation).to receive(:wait_until).with(:stack_update_complete, stack_name: stack_name).and_return(nil)
|
95
|
-
allow(cloudformation).to receive(:describe_stacks).with({stack_name: stack_name}).and_return(
|
96
|
-
stack_result_list_with_status('CREATE_COMPLETE', stack_name),
|
97
|
-
stack_result_list_with_status('UPDATE_COMPLETE', stack_name)
|
98
|
-
)
|
99
|
-
allow(cloudformation).to receive(:update_stack).with(cf_stack_update_params).and_return("stack_id")
|
100
|
-
end
|
101
|
-
|
102
|
-
EXAMPLE_CFN_STACK_FILENAMES = ['app.json', 'rds.json']
|
103
|
-
|
104
|
-
EXAMPLE_CFN_STACK_FILENAMES.each do |stack_filename|
|
105
|
-
it "uses a file in the form of #{stack_filename}.erb" do
|
106
|
-
expect(KumoKeisei::EnvironmentConfig).to receive(:new).with(stack_config.merge(params_template_file_path: "#{stack_filename}.erb")).and_return(double(:environment_config, cf_params: {}))
|
107
|
-
expect(File).to receive(:absolute_path).and_return("#{stack_filename}.erb")
|
108
|
-
subject.apply!(stack_config)
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
94
|
context "when the stack is updatable" do
|
114
95
|
UPDATEABLE_STATUSES = ['UPDATE_ROLLBACK_COMPLETE', 'CREATE_COMPLETE', 'UPDATE_COMPLETE']
|
115
96
|
|
@@ -304,11 +285,8 @@ describe KumoKeisei::Stack do
|
|
304
285
|
|
305
286
|
describe "#config" do
|
306
287
|
context "when passed a config_path and params_template_file_path" do
|
307
|
-
before do
|
308
|
-
allow(KumoKeisei::EnvironmentConfig).to receive(:new).with(stack_config.merge(params_template_file_path: "#{app_name}.yml.erb")).and_return(double(:environment_config, cf_params: {}, config: { :foo=> 'bar', :baz=> 'qux' }))
|
309
|
-
end
|
310
|
-
|
311
288
|
it "will return the results of the nested KumoKeisei::EnvironmentConfig.config" do
|
289
|
+
expect(KumoKeisei::EnvironmentConfig).to receive(:new).with(stack_config.merge(params_template_file_path: "/#{stack_template_name}.yml.erb")).and_return(double(:environment_config, cf_params: {}, config: { :foo=> 'bar', :baz=> 'qux' }))
|
312
290
|
expect(subject.config(stack_config)).to eq({:foo=> 'bar', :baz=>'qux'})
|
313
291
|
end
|
314
292
|
end
|
@@ -321,11 +299,8 @@ describe KumoKeisei::Stack do
|
|
321
299
|
}
|
322
300
|
}
|
323
301
|
|
324
|
-
before do
|
325
|
-
allow(KumoKeisei::EnvironmentConfig).to receive(:new).with(stack_config.merge(params_template_file_path: nil)).and_return(double(:environment_config, cf_params: {}, config: { :foo=> 'bar', :baz=> 'qux' }))
|
326
|
-
end
|
327
|
-
|
328
302
|
it "will return the results of the nested KumoKeisei::EnvironmentConfig.config" do
|
303
|
+
expect(KumoKeisei::EnvironmentConfig).to receive(:new).with(stack_config.merge(params_template_file_path: nil)).and_return(double(:environment_config, cf_params: {}, config: { :foo=> 'bar', :baz=> 'qux' }))
|
329
304
|
expect(subject.config(stack_config)).to eq({:foo=> 'bar', :baz=>'qux'})
|
330
305
|
end
|
331
306
|
end
|
@@ -343,4 +318,37 @@ describe KumoKeisei::Stack do
|
|
343
318
|
end
|
344
319
|
end
|
345
320
|
|
321
|
+
describe "#params_template_path" do
|
322
|
+
context "when looking for the parameter template file" do
|
323
|
+
CFN_STACK_TEMPLATE_TO_PARAMATER_TEMPLATE = {
|
324
|
+
'app.json' => 'app.yml.erb',
|
325
|
+
'rds.json' => 'rds.yml.erb'
|
326
|
+
}
|
327
|
+
|
328
|
+
CFN_STACK_TEMPLATE_TO_PARAMATER_TEMPLATE.each_pair do |cfn_template, parameter_template|
|
329
|
+
context "given #{cfn_template}" do
|
330
|
+
let(:stack_cfntemplate_filename) { "#{cfn_template}" }
|
331
|
+
it "uses a matching file in the form of #{parameter_template}" do
|
332
|
+
expect(subject.params_template_path(stack_config)).to eq(File.join(Dir.pwd, parameter_template))
|
333
|
+
end
|
334
|
+
end
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
context "when the parameter template file has not been passed in" do
|
339
|
+
let(:stack_config) {
|
340
|
+
{
|
341
|
+
config_path: 'config-path',
|
342
|
+
injected_config: { 'VpcId' => 'vpc-id' },
|
343
|
+
env_name: 'non-production'
|
344
|
+
}
|
345
|
+
}
|
346
|
+
|
347
|
+
it "will return nil" do
|
348
|
+
expect(subject.params_template_path(stack_config)).to be_nil
|
349
|
+
end
|
350
|
+
end
|
351
|
+
|
352
|
+
end
|
353
|
+
|
346
354
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kumo_keisei
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.1.pre.
|
4
|
+
version: 3.1.1.pre.alpha3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Redbubble
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|