simple_deploy 0.9.2 → 0.10.0.beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/simple_deploy/aws/cloud_formation.rb +5 -5
- data/lib/simple_deploy/aws/helpers.rb +20 -0
- data/lib/simple_deploy/aws/instance_reader.rb +10 -13
- data/lib/simple_deploy/aws/simpledb.rb +5 -5
- data/lib/simple_deploy/aws.rb +1 -0
- data/lib/simple_deploy/cli/attributes.rb +4 -2
- data/lib/simple_deploy/cli/clone.rb +8 -3
- data/lib/simple_deploy/cli/create.rb +4 -2
- data/lib/simple_deploy/cli/deploy.rb +4 -2
- data/lib/simple_deploy/cli/destroy.rb +4 -2
- data/lib/simple_deploy/cli/events.rb +4 -2
- data/lib/simple_deploy/cli/execute.rb +4 -2
- data/lib/simple_deploy/cli/instances.rb +4 -2
- data/lib/simple_deploy/cli/list.rb +5 -2
- data/lib/simple_deploy/cli/outputs.rb +4 -2
- data/lib/simple_deploy/cli/parameters.rb +4 -2
- data/lib/simple_deploy/cli/protect.rb +4 -2
- data/lib/simple_deploy/cli/resources.rb +4 -2
- data/lib/simple_deploy/cli/shared.rb +34 -2
- data/lib/simple_deploy/cli/status.rb +4 -2
- data/lib/simple_deploy/cli/template.rb +4 -2
- data/lib/simple_deploy/cli/update.rb +4 -2
- data/lib/simple_deploy/configuration.rb +39 -4
- data/lib/simple_deploy/version.rb +1 -1
- data/spec/aws/cloud_formation_spec.rb +162 -135
- data/spec/aws/helpers_spec.rb +51 -0
- data/spec/aws/instance_reader_spec.rb +181 -167
- data/spec/aws/simpledb_spec.rb +78 -50
- data/spec/cli/attributes_spec.rb +22 -2
- data/spec/cli/clone_spec.rb +7 -8
- data/spec/cli/deploy_spec.rb +7 -10
- data/spec/cli/destroy_spec.rb +3 -4
- data/spec/cli/protect_spec.rb +7 -11
- data/spec/cli/shared_spec.rb +107 -17
- data/spec/cli/update_spec.rb +4 -7
- data/spec/config_spec.rb +50 -3
- metadata +7 -4
data/spec/cli/attributes_spec.rb
CHANGED
@@ -7,6 +7,26 @@ describe SimpleDeploy::CLI::Attributes do
|
|
7
7
|
include_context 'double stubbed stack', :name => 'my_stack',
|
8
8
|
:environment => 'my_env'
|
9
9
|
|
10
|
+
describe 'with --read-from-env' do
|
11
|
+
before do
|
12
|
+
@options = { :environment => nil,
|
13
|
+
:log_level => 'debug',
|
14
|
+
:name => 'my_stack',
|
15
|
+
:read_from_env => true }
|
16
|
+
@stack_stub.stub(:attributes).and_return({ 'foo' => 'bar', 'baz' => 'blah' })
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should output the attributes' do
|
20
|
+
subject.should_receive(:valid_options?).
|
21
|
+
with(:provided => @options,
|
22
|
+
:required => [:environment, :name, :read_from_env])
|
23
|
+
Trollop.stub(:options).and_return(@options)
|
24
|
+
subject.should_receive(:puts).with('foo: bar')
|
25
|
+
subject.should_receive(:puts).with('baz: blah')
|
26
|
+
subject.show
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
10
30
|
describe 'show' do
|
11
31
|
before do
|
12
32
|
@options = { :environment => 'my_env',
|
@@ -18,7 +38,7 @@ describe SimpleDeploy::CLI::Attributes do
|
|
18
38
|
it 'should output the attributes' do
|
19
39
|
subject.should_receive(:valid_options?).
|
20
40
|
with(:provided => @options,
|
21
|
-
:required => [:environment, :name])
|
41
|
+
:required => [:environment, :name, :read_from_env])
|
22
42
|
Trollop.stub(:options).and_return(@options)
|
23
43
|
subject.should_receive(:puts).with('foo: bar')
|
24
44
|
subject.should_receive(:puts).with('baz: blah')
|
@@ -31,7 +51,7 @@ describe SimpleDeploy::CLI::Attributes do
|
|
31
51
|
Trollop.stub(:options).and_return(@options)
|
32
52
|
subject.should_receive(:valid_options?).
|
33
53
|
with(:provided => @options,
|
34
|
-
:required => [:environment, :name])
|
54
|
+
:required => [:environment, :name, :read_from_env])
|
35
55
|
end
|
36
56
|
|
37
57
|
it 'should output the attributes as command arguments' do
|
data/spec/cli/clone_spec.rb
CHANGED
@@ -9,6 +9,8 @@ describe SimpleDeploy::CLI::Clone do
|
|
9
9
|
:new_name => 'new_stack',
|
10
10
|
:new_env => 'my_env'
|
11
11
|
|
12
|
+
before { @required = [:environment, :source_name, :new_name, :read_from_env] }
|
13
|
+
|
12
14
|
describe 'clone' do
|
13
15
|
context 'filter_attributes' do
|
14
16
|
before do
|
@@ -146,8 +148,7 @@ describe SimpleDeploy::CLI::Clone do
|
|
146
148
|
|
147
149
|
it 'should create the new stack using the filtered, merged and added attributes' do
|
148
150
|
subject.should_receive(:valid_options?).
|
149
|
-
with(:provided => @options,
|
150
|
-
:required => [:environment, :source_name, :new_name])
|
151
|
+
with(:provided => @options, :required => @required)
|
151
152
|
Trollop.stub(:options).and_return(@options)
|
152
153
|
@new_stack_mock.stub(:template).and_return('foo' => 'bah')
|
153
154
|
|
@@ -169,8 +170,7 @@ describe SimpleDeploy::CLI::Clone do
|
|
169
170
|
@options[:template] = 'brand_new_template.json'
|
170
171
|
|
171
172
|
subject.should_receive(:valid_options?).
|
172
|
-
with(:provided => @options,
|
173
|
-
:required => [:environment, :source_name, :new_name])
|
173
|
+
with(:provided => @options, :required => @required)
|
174
174
|
Trollop.stub(:options).and_return(@options)
|
175
175
|
|
176
176
|
@new_stack_mock.should_receive(:create) do |options|
|
@@ -196,7 +196,7 @@ describe SimpleDeploy::CLI::Clone do
|
|
196
196
|
:new_name => 'new_stack',
|
197
197
|
:attributes => ['chef_repo_bucket_prefix=updated-intu-lc',
|
198
198
|
'chef_repo_domain=updated_community_chef_repo',
|
199
|
-
'SolrClientTrafficContainer=solr-client-traffic-container',
|
199
|
+
'SolrClientTrafficContainer=solr-client-traffic-container',
|
200
200
|
'InputStackOutputs=cmdline_value'] }
|
201
201
|
|
202
202
|
input_attributes = [{'InputStackOutputs' => 'inputvalue'}, {'OutputValue' => 'outputs'}]
|
@@ -204,8 +204,7 @@ describe SimpleDeploy::CLI::Clone do
|
|
204
204
|
SimpleDeploy::Stack::OutputMapper.stub :new => input_stub
|
205
205
|
|
206
206
|
subject.should_receive(:valid_options?).
|
207
|
-
with(:provided => options,
|
208
|
-
:required => [:environment, :source_name, :new_name])
|
207
|
+
with(:provided => options, :required => @required)
|
209
208
|
Trollop.stub(:options).and_return(options)
|
210
209
|
|
211
210
|
@new_stack_mock.stub(:template).and_return('foo' => 'bah')
|
@@ -219,7 +218,7 @@ describe SimpleDeploy::CLI::Clone do
|
|
219
218
|
{ 'InputStackOutputs' => 'cmdline_value' },
|
220
219
|
{ 'OutputValue' => 'outputs'},
|
221
220
|
{ 'SolrClientTrafficContainer' => 'solr-client-traffic-container' }]
|
222
|
-
|
221
|
+
|
223
222
|
options[:template].should match /brand_new_template.json/
|
224
223
|
end
|
225
224
|
|
data/spec/cli/deploy_spec.rb
CHANGED
@@ -9,6 +9,8 @@ describe SimpleDeploy::CLI::Deploy do
|
|
9
9
|
:environment => 'my_env',
|
10
10
|
:internal => false
|
11
11
|
|
12
|
+
before { @required = [:environment, :name, :read_from_env] }
|
13
|
+
|
12
14
|
describe 'deploy' do
|
13
15
|
before do
|
14
16
|
@stack_mock.stub(:attributes).and_return({})
|
@@ -24,8 +26,7 @@ describe SimpleDeploy::CLI::Deploy do
|
|
24
26
|
:attributes => [] }
|
25
27
|
|
26
28
|
subject.should_receive(:valid_options?).
|
27
|
-
with(:provided => options,
|
28
|
-
:required => [:environment, :name])
|
29
|
+
with(:provided => options, :required => @required)
|
29
30
|
Trollop.stub(:options).and_return(options)
|
30
31
|
|
31
32
|
SimpleDeploy::Notifier.should_receive(:new).
|
@@ -51,8 +52,7 @@ describe SimpleDeploy::CLI::Deploy do
|
|
51
52
|
:attributes => [] }
|
52
53
|
|
53
54
|
subject.should_receive(:valid_options?).
|
54
|
-
with(:provided => options,
|
55
|
-
:required => [:environment, :name])
|
55
|
+
with(:provided => options, :required => @required)
|
56
56
|
Trollop.stub(:options).and_return(options)
|
57
57
|
|
58
58
|
SimpleDeploy::Notifier.should_receive(:new).
|
@@ -81,8 +81,7 @@ describe SimpleDeploy::CLI::Deploy do
|
|
81
81
|
:attributes => ['foo=bah'] }
|
82
82
|
|
83
83
|
subject.should_receive(:valid_options?).
|
84
|
-
with(:provided => options,
|
85
|
-
:required => [:environment, :name])
|
84
|
+
with(:provided => options, :required => @required)
|
86
85
|
Trollop.stub(:options).and_return(options)
|
87
86
|
|
88
87
|
SimpleDeploy::Notifier.should_receive(:new).
|
@@ -109,8 +108,7 @@ describe SimpleDeploy::CLI::Deploy do
|
|
109
108
|
:attributes => ['foo=bah'] }
|
110
109
|
|
111
110
|
subject.should_receive(:valid_options?).
|
112
|
-
with(:provided => options,
|
113
|
-
:required => [:environment, :name])
|
111
|
+
with(:provided => options, :required => @required)
|
114
112
|
Trollop.stub(:options).and_return(options)
|
115
113
|
|
116
114
|
SimpleDeploy::Notifier.should_receive(:new).
|
@@ -139,8 +137,7 @@ describe SimpleDeploy::CLI::Deploy do
|
|
139
137
|
:attributes => [] }
|
140
138
|
|
141
139
|
subject.should_receive(:valid_options?).
|
142
|
-
with(:provided => options,
|
143
|
-
:required => [:environment, :name])
|
140
|
+
with(:provided => options, :required => @required)
|
144
141
|
Trollop.stub(:options).and_return(options)
|
145
142
|
|
146
143
|
SimpleDeploy::Notifier.should_receive(:new).
|
data/spec/cli/destroy_spec.rb
CHANGED
@@ -13,13 +13,13 @@ describe SimpleDeploy::CLI::Destroy do
|
|
13
13
|
@options = { :environment => 'my_env',
|
14
14
|
:log_level => 'debug',
|
15
15
|
:name => 'my_stack' }
|
16
|
+
@required = [:environment, :name, :read_from_env]
|
16
17
|
@stack_mock.stub(:attributes).and_return({})
|
17
18
|
end
|
18
19
|
|
19
20
|
it "should exit with 0" do
|
20
21
|
subject.should_receive(:valid_options?).
|
21
|
-
with(:provided => @options,
|
22
|
-
:required => [:environment, :name])
|
22
|
+
with(:provided => @options, :required => @required)
|
23
23
|
Trollop.stub(:options).and_return(@options)
|
24
24
|
|
25
25
|
@stack_mock.should_receive(:destroy).and_return(true)
|
@@ -33,8 +33,7 @@ describe SimpleDeploy::CLI::Destroy do
|
|
33
33
|
|
34
34
|
it "should exit with 1" do
|
35
35
|
subject.should_receive(:valid_options?).
|
36
|
-
with(:provided => @options,
|
37
|
-
:required => [:environment, :name])
|
36
|
+
with(:provided => @options, :required => @required)
|
38
37
|
Trollop.stub(:options).and_return(@options)
|
39
38
|
|
40
39
|
@stack_mock.should_receive(:destroy).and_return(false)
|
data/spec/cli/protect_spec.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
require 'spec_helper'
|
3
2
|
require 'simple_deploy/cli'
|
4
3
|
|
@@ -12,15 +11,15 @@ describe SimpleDeploy::CLI::Protect do
|
|
12
11
|
:log_level => 'debug',
|
13
12
|
:name => ['my_stack1'],
|
14
13
|
:protection => 'on' }
|
14
|
+
@required = [:environment, :name, :read_from_env]
|
15
15
|
end
|
16
16
|
|
17
17
|
context "single stack" do
|
18
18
|
include_context 'received stack array', 'my_stack', 'my_env', 1
|
19
|
-
|
19
|
+
|
20
20
|
it "should enable protection" do
|
21
21
|
subject.should_receive(:valid_options?).
|
22
|
-
with(:provided => @options,
|
23
|
-
:required => [:environment, :name])
|
22
|
+
with(:provided => @options, :required => @required)
|
24
23
|
Trollop.stub(:options).and_return(@options)
|
25
24
|
|
26
25
|
@stack_mock1.stub(:attributes).and_return('protection' => 'on')
|
@@ -34,8 +33,7 @@ describe SimpleDeploy::CLI::Protect do
|
|
34
33
|
@options[:protection]= 'off'
|
35
34
|
|
36
35
|
subject.should_receive(:valid_options?).
|
37
|
-
with(:provided => @options,
|
38
|
-
:required => [:environment, :name])
|
36
|
+
with(:provided => @options, :required => @required)
|
39
37
|
Trollop.stub(:options).and_return(@options)
|
40
38
|
|
41
39
|
@stack_mock1.stub(:attributes).and_return('protection' => 'off')
|
@@ -53,8 +51,7 @@ describe SimpleDeploy::CLI::Protect do
|
|
53
51
|
@options[:name] = ['my_stack1', 'my_stack2']
|
54
52
|
|
55
53
|
subject.should_receive(:valid_options?).
|
56
|
-
with(:provided => @options,
|
57
|
-
:required => [:environment, :name])
|
54
|
+
with(:provided => @options, :required => @required)
|
58
55
|
Trollop.stub(:options).and_return(@options)
|
59
56
|
|
60
57
|
@stack_mock1.stub(:attributes).and_return('protection' => 'on')
|
@@ -72,8 +69,7 @@ describe SimpleDeploy::CLI::Protect do
|
|
72
69
|
@options[:protection]= 'off'
|
73
70
|
|
74
71
|
subject.should_receive(:valid_options?).
|
75
|
-
with(:provided => @options,
|
76
|
-
:required => [:environment, :name])
|
72
|
+
with(:provided => @options, :required => @required)
|
77
73
|
Trollop.stub(:options).and_return(@options)
|
78
74
|
|
79
75
|
@stack_mock1.stub(:attributes).and_return('protection' => 'off')
|
@@ -87,5 +83,5 @@ describe SimpleDeploy::CLI::Protect do
|
|
87
83
|
end
|
88
84
|
end
|
89
85
|
|
90
|
-
end
|
86
|
+
end
|
91
87
|
end
|
data/spec/cli/shared_spec.rb
CHANGED
@@ -15,31 +15,121 @@ describe SimpleDeploy::CLI::Shared do
|
|
15
15
|
|
16
16
|
@object.parse_attributes(:logger => @logger_stub,
|
17
17
|
:attributes => attributes).
|
18
|
-
should == [ { "test1" => "value1" },
|
18
|
+
should == [ { "test1" => "value1" },
|
19
19
|
{ "test2" => "value2==" } ]
|
20
20
|
end
|
21
21
|
|
22
22
|
context "validating options " do
|
23
|
-
|
24
|
-
provided = { :
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
23
|
+
describe 'when providing both environment and read_from_env' do
|
24
|
+
before { @provided = { environment: 'env', read_from_env: true } }
|
25
|
+
|
26
|
+
it 'exits' do
|
27
|
+
lambda {
|
28
|
+
@object.valid_options? provided: @provided,
|
29
|
+
required: [:environment, :read_from_env]
|
30
|
+
}.should raise_error SystemExit
|
31
|
+
end
|
31
32
|
end
|
32
33
|
|
33
|
-
|
34
|
-
|
34
|
+
describe 'when either environment or read from env is required' do
|
35
|
+
before { @required = [:environment, :read_from_env] }
|
35
36
|
|
36
|
-
|
37
|
-
|
37
|
+
describe 'and neither is provided' do
|
38
|
+
it 'exits' do
|
39
|
+
lambda {
|
40
|
+
@object.valid_options? provided: {}, required: @required
|
41
|
+
}.should raise_error SystemExit
|
42
|
+
end
|
43
|
+
end
|
38
44
|
|
39
|
-
|
40
|
-
|
45
|
+
describe 'and environment is provided' do
|
46
|
+
describe 'and the environment exists' do
|
47
|
+
|
48
|
+
it 'does not exit' do
|
49
|
+
config_stub = stub 'config stub',
|
50
|
+
environments: { 'prod' => 'data' },
|
51
|
+
keys: ['prod']
|
52
|
+
|
53
|
+
provided = { :environment => 'prod', :test1 => 'value1' }
|
54
|
+
required = [:environment, :read_from_env, :test1]
|
55
|
+
|
56
|
+
SimpleDeploy.stub(:environments).and_return(config_stub)
|
57
|
+
|
58
|
+
@object.valid_options? :provided => provided,
|
59
|
+
:required => required,
|
60
|
+
:logger => @logger_stub
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe 'and the environment does not exist' do
|
65
|
+
|
66
|
+
it "exits" do
|
67
|
+
config_stub = stub 'config stub',
|
68
|
+
environments: { 'preprod' => 'data' },
|
69
|
+
keys: ['preprod']
|
70
|
+
|
71
|
+
provided = { :environment => 'prod' }
|
72
|
+
required = [:environment, :read_from_env]
|
73
|
+
|
74
|
+
SimpleDeploy.stub(:environments).and_return(config_stub)
|
75
|
+
|
76
|
+
lambda {
|
77
|
+
@object.valid_options? provided: provided,
|
78
|
+
required: required
|
79
|
+
}.should raise_error SystemExit
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe 'and read from env is provided' do
|
85
|
+
describe 'and the env vars are set' do
|
86
|
+
before do
|
87
|
+
ENV['AWS_ACCESS_KEY_ID'] = 'access'
|
88
|
+
ENV['AWS_SECRET_ACCESS_KEY'] = 'secret'
|
89
|
+
ENV['AWS_REGION'] = 'us-west-1'
|
90
|
+
end
|
91
|
+
|
92
|
+
after do
|
93
|
+
ENV['AWS_ACCESS_KEY_ID'] = nil
|
94
|
+
ENV['AWS_SECRET_ACCESS_KEY'] = nil
|
95
|
+
ENV['AWS_REGION'] = nil
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'does not exit' do
|
99
|
+
provided = { read_from_env: true, test1: 'value1' }
|
100
|
+
required = [:environment, :read_from_env, :test1]
|
101
|
+
|
102
|
+
@object.valid_options? :provided => provided,
|
103
|
+
:required => required,
|
104
|
+
:logger => @logger_stub
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
|
109
|
+
describe 'and the env vars are not set' do
|
110
|
+
|
111
|
+
it 'exits' do
|
112
|
+
provided = { read_from_env: true }
|
113
|
+
required = [:environment, :read_from_env]
|
114
|
+
|
115
|
+
# SimpleDeploy.stub(:environments).and_return(config_stub)
|
116
|
+
|
117
|
+
lambda {
|
118
|
+
@object.valid_options? provided: provided, required: required
|
119
|
+
}.should raise_error SystemExit
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
127
|
+
|
128
|
+
it "should exit if provided options passed do not include all required" do
|
129
|
+
provided = { :test1 => 'test1', :test2 => 'test2' }
|
130
|
+
required = [:test1, :test2, :test3]
|
41
131
|
|
42
|
-
lambda {
|
132
|
+
lambda {
|
43
133
|
@object.valid_options? :provided => provided,
|
44
134
|
:required => required
|
45
135
|
}.should raise_error SystemExit
|
@@ -67,7 +157,7 @@ describe SimpleDeploy::CLI::Shared do
|
|
67
157
|
it "should rescue exceptions and exit 1" do
|
68
158
|
lambda { @object.rescue_exceptions_and_exit do
|
69
159
|
raise SimpleDeploy::Exceptions::Base
|
70
|
-
end
|
160
|
+
end
|
71
161
|
}.should raise_error SystemExit
|
72
162
|
end
|
73
163
|
end
|
data/spec/cli/update_spec.rb
CHANGED
@@ -17,13 +17,12 @@ describe SimpleDeploy::CLI::Update do
|
|
17
17
|
:name => ['my_stack1'],
|
18
18
|
:force => true,
|
19
19
|
:attributes => ['chef_repo_bucket_prefix=intu-lc'] }
|
20
|
-
|
20
|
+
@required = [:environment, :name, :read_from_env]
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should pass force true" do
|
24
24
|
subject.should_receive(:valid_options?).
|
25
|
-
with(:provided => @options,
|
26
|
-
:required => [:environment, :name])
|
25
|
+
with(:provided => @options, :required => @required)
|
27
26
|
|
28
27
|
Trollop.stub(:options).and_return(@options)
|
29
28
|
|
@@ -36,8 +35,7 @@ describe SimpleDeploy::CLI::Update do
|
|
36
35
|
@options[:force] = false
|
37
36
|
|
38
37
|
subject.should_receive(:valid_options?).
|
39
|
-
with(:provided => @options,
|
40
|
-
:required => [:environment, :name])
|
38
|
+
with(:provided => @options, :required => @required)
|
41
39
|
|
42
40
|
Trollop.stub(:options).and_return(@options)
|
43
41
|
|
@@ -50,8 +48,7 @@ describe SimpleDeploy::CLI::Update do
|
|
50
48
|
@options[:template] = 'brand_new_template.json'
|
51
49
|
|
52
50
|
subject.should_receive(:valid_options?).
|
53
|
-
with(:provided => @options,
|
54
|
-
:required => [:environment, :name])
|
51
|
+
with(:provided => @options, :required => @required)
|
55
52
|
|
56
53
|
Trollop.stub(:options).and_return(@options)
|
57
54
|
|
data/spec/config_spec.rb
CHANGED
@@ -4,9 +4,10 @@ describe SimpleDeploy::Configuration do
|
|
4
4
|
let(:config_data) do
|
5
5
|
{ 'environments' => {
|
6
6
|
'test_env' => {
|
7
|
-
'
|
8
|
-
'
|
9
|
-
'
|
7
|
+
'access_key' => 'access',
|
8
|
+
'secret_key' => 'secret',
|
9
|
+
'security_token' => 'token',
|
10
|
+
'region' => 'us-west-1'
|
10
11
|
} },
|
11
12
|
'notifications' => {
|
12
13
|
'campfire' => {
|
@@ -49,6 +50,34 @@ describe SimpleDeploy::Configuration do
|
|
49
50
|
@config.notifications.should == config_data['notifications']
|
50
51
|
end
|
51
52
|
|
53
|
+
describe 'when the environment is :read_from_env' do
|
54
|
+
before do
|
55
|
+
ENV['AWS_ACCESS_KEY_ID'] = 'env_access'
|
56
|
+
ENV['AWS_REGION'] = 'env_region'
|
57
|
+
ENV['AWS_SECRET_ACCESS_KEY'] = 'env_secret'
|
58
|
+
ENV['AWS_SECURITY_TOKEN'] = 'env_token'
|
59
|
+
|
60
|
+
@data = {
|
61
|
+
'access_key' => 'env_access',
|
62
|
+
'region' => 'env_region',
|
63
|
+
'secret_key' => 'env_secret',
|
64
|
+
'security_token' => 'env_token'
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
after do
|
69
|
+
%w(ACCESS_KEY_ID REGION SECRET_ACCESS_KEY SECURITY_TOKEN).each do |i|
|
70
|
+
ENV["AWS_#{i}"] = nil
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'loads the config from env vars' do
|
75
|
+
@config = @the_module.configure :read_from_env
|
76
|
+
@config.environment.should eq(@data)
|
77
|
+
@config.notifications.should eq({})
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
52
81
|
end
|
53
82
|
|
54
83
|
describe "after creating a configuration" do
|
@@ -73,6 +102,7 @@ describe SimpleDeploy::Configuration do
|
|
73
102
|
env_config = @config.environment
|
74
103
|
env_config['access_key'].should == 'access'
|
75
104
|
env_config['secret_key'].should == 'secret'
|
105
|
+
env_config['security_token'].should == 'token'
|
76
106
|
env_config['region'].should == 'us-west-1'
|
77
107
|
end
|
78
108
|
|
@@ -88,6 +118,10 @@ describe SimpleDeploy::Configuration do
|
|
88
118
|
@config.secret_key.should == 'secret'
|
89
119
|
end
|
90
120
|
|
121
|
+
it "should return the security token for the environment" do
|
122
|
+
@config.security_token.should == 'token'
|
123
|
+
end
|
124
|
+
|
91
125
|
it "should return the region for the environment" do
|
92
126
|
@config.region.should == 'us-west-1'
|
93
127
|
end
|
@@ -96,6 +130,19 @@ describe SimpleDeploy::Configuration do
|
|
96
130
|
@config.deploy_script.should == '/opt/intu/admin/bin/configure.sh'
|
97
131
|
end
|
98
132
|
|
133
|
+
describe 'temporary_credentials?' do
|
134
|
+
it 'is true when they are' do
|
135
|
+
@config.temporary_credentials?.should be_true
|
136
|
+
end
|
137
|
+
|
138
|
+
describe 'when there is not a security token' do
|
139
|
+
it 'is false when they are not' do
|
140
|
+
config_data['environments']['test_env']['security_token'] = nil
|
141
|
+
@config = @the_module.configure 'test_env', config: config_data
|
142
|
+
@config.temporary_credentials?.should be_false
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
99
146
|
end
|
100
147
|
|
101
148
|
describe 'showing raw configuration for all instances' do
|