simple_deploy 0.9.2 → 0.10.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -19,12 +19,14 @@ EOS
|
|
19
19
|
opt :help, "Display Help"
|
20
20
|
opt :environment, "Set the target environment", :type => :string
|
21
21
|
opt :name, "Stack name to manage", :type => :string
|
22
|
+
opt :read_from_env, "Read credentials and region from environment variables"
|
22
23
|
end
|
23
24
|
|
24
25
|
valid_options? :provided => @opts,
|
25
|
-
:required => [:environment, :name]
|
26
|
+
:required => [:environment, :name, :read_from_env]
|
26
27
|
|
27
|
-
|
28
|
+
config_arg = @opts[:read_from_env] ? :read_from_env : @opts[:environment]
|
29
|
+
SimpleDeploy.create_config config_arg
|
28
30
|
SimpleDeploy.logger @opts[:log_level]
|
29
31
|
stack = Stack.new :name => @opts[:name],
|
30
32
|
:environment => @opts[:environment]
|
@@ -19,12 +19,14 @@ EOS
|
|
19
19
|
opt :help, "Display Help"
|
20
20
|
opt :environment, "Set the target environment", :type => :string
|
21
21
|
opt :name, "Stack name to manage", :type => :string
|
22
|
+
opt :read_from_env, "Read credentials and region from environment variables"
|
22
23
|
end
|
23
24
|
|
24
25
|
valid_options? :provided => @opts,
|
25
|
-
:required => [:environment, :name]
|
26
|
+
:required => [:environment, :name, :read_from_env]
|
26
27
|
|
27
|
-
|
28
|
+
config_arg = @opts[:read_from_env] ? :read_from_env : @opts[:environment]
|
29
|
+
SimpleDeploy.create_config config_arg
|
28
30
|
SimpleDeploy.logger @opts[:log_level]
|
29
31
|
stack = Stack.new :name => @opts[:name],
|
30
32
|
:environment => @opts[:environment]
|
@@ -25,13 +25,15 @@ EOS
|
|
25
25
|
:default => 'info'
|
26
26
|
opt :name, "Stack name(s) of stack to deploy", :type => :string,
|
27
27
|
:multi => true
|
28
|
+
opt :read_from_env, "Read credentials and region from environment variables"
|
28
29
|
opt :template, "Path to a new template file", :type => :string
|
29
30
|
end
|
30
31
|
|
31
32
|
valid_options? :provided => @opts,
|
32
|
-
:required => [:environment, :name]
|
33
|
+
:required => [:environment, :name, :read_from_env]
|
33
34
|
|
34
|
-
|
35
|
+
config_arg = @opts[:read_from_env] ? :read_from_env : @opts[:environment]
|
36
|
+
SimpleDeploy.create_config config_arg
|
35
37
|
SimpleDeploy.logger @opts[:log_level]
|
36
38
|
|
37
39
|
attributes = parse_attributes :attributes => @opts[:attributes]
|
@@ -4,9 +4,13 @@ module SimpleDeploy
|
|
4
4
|
extend self
|
5
5
|
|
6
6
|
def configure(environment, custom_config = {})
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
if custom_config.has_key?(:config)
|
8
|
+
env_config = custom_config[:config]['environments'][environment]
|
9
|
+
notifications = custom_config[:config]['notifications']
|
10
|
+
else
|
11
|
+
env_config, notifications = load_appropriate_config(environment)
|
12
|
+
end
|
13
|
+
Config.new env_config, notifications
|
10
14
|
end
|
11
15
|
|
12
16
|
def environments(custom_config = {})
|
@@ -16,6 +20,14 @@ module SimpleDeploy
|
|
16
20
|
|
17
21
|
private
|
18
22
|
|
23
|
+
def load_appropriate_config(env)
|
24
|
+
if env == :read_from_env
|
25
|
+
load_config_from_env_vars
|
26
|
+
else
|
27
|
+
load_config_from_file env
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
19
31
|
def load_config_file
|
20
32
|
begin
|
21
33
|
YAML::load File.open(config_file)
|
@@ -26,6 +38,22 @@ module SimpleDeploy
|
|
26
38
|
end
|
27
39
|
end
|
28
40
|
|
41
|
+
def load_config_from_file(env)
|
42
|
+
config = load_config_file
|
43
|
+
return config['environments'][env], config['notifications']
|
44
|
+
end
|
45
|
+
|
46
|
+
def load_config_from_env_vars
|
47
|
+
env_config = {
|
48
|
+
'access_key' => ENV['AWS_ACCESS_KEY_ID'],
|
49
|
+
'region' => ENV['AWS_REGION'],
|
50
|
+
'secret_key' => ENV['AWS_SECRET_ACCESS_KEY'],
|
51
|
+
'security_token' => ENV['AWS_SECURITY_TOKEN']
|
52
|
+
}
|
53
|
+
|
54
|
+
return env_config, {}
|
55
|
+
end
|
56
|
+
|
29
57
|
def config_file
|
30
58
|
env_config_file || default_config_file
|
31
59
|
end
|
@@ -82,10 +110,18 @@ module SimpleDeploy
|
|
82
110
|
@environment['secret_key']
|
83
111
|
end
|
84
112
|
|
113
|
+
def security_token
|
114
|
+
@environment['security_token']
|
115
|
+
end
|
116
|
+
|
85
117
|
def region
|
86
118
|
@environment['region']
|
87
119
|
end
|
88
120
|
|
121
|
+
def temporary_credentials?
|
122
|
+
!!security_token
|
123
|
+
end
|
124
|
+
|
89
125
|
private
|
90
126
|
|
91
127
|
def env_home
|
@@ -96,7 +132,6 @@ module SimpleDeploy
|
|
96
132
|
env.load 'USER'
|
97
133
|
end
|
98
134
|
|
99
|
-
|
100
135
|
end
|
101
136
|
end
|
102
137
|
end
|
@@ -1,23 +1,17 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe SimpleDeploy::AWS::CloudFormation do
|
4
|
-
include_context 'double stubbed config', :access_key => 'key',
|
5
|
-
:secret_key => 'XXX',
|
6
|
-
:region => 'us-west-1'
|
7
4
|
include_context 'double stubbed logger'
|
8
5
|
|
9
6
|
before do
|
10
7
|
@error_stub = stub 'Error', :process => 'Processed Error'
|
11
|
-
@response_stub = stub 'Excon::Response', :body => {
|
8
|
+
@response_stub = stub 'Excon::Response', :body => {
|
12
9
|
'Stacks' => [{'StackStatus' => 'green', 'Outputs' => [{'key' => 'value'}]}],
|
13
10
|
'StackResources' => [{'StackName' => 'my_stack'}],
|
14
11
|
'StackEvents' => ['event1', 'event2'],
|
15
12
|
'TemplateBody' => '{EIP: "string"}'
|
16
13
|
}
|
17
14
|
|
18
|
-
@cf_mock = mock 'CloudFormation'
|
19
|
-
Fog::AWS::CloudFormation.stub(:new).and_return(@cf_mock)
|
20
|
-
|
21
15
|
@args = {
|
22
16
|
:parameters => { 'parameter1' => 'my_param' },
|
23
17
|
:name => 'my_stack',
|
@@ -25,183 +19,216 @@ describe SimpleDeploy::AWS::CloudFormation do
|
|
25
19
|
}
|
26
20
|
|
27
21
|
@exception = Exception.new('Failed')
|
28
|
-
|
29
|
-
@cf = SimpleDeploy::AWS::CloudFormation.new
|
30
22
|
end
|
31
23
|
|
32
24
|
after do
|
33
25
|
SimpleDeploy.release_config
|
34
26
|
end
|
35
27
|
|
36
|
-
describe
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
})
|
28
|
+
describe 'temporary credentials' do
|
29
|
+
include_context 'double stubbed config', :access_key => 'key',
|
30
|
+
:secret_key => 'XXX',
|
31
|
+
:security_token => 'the token',
|
32
|
+
:temporary_credentials? => true,
|
33
|
+
:region => 'us-west-1'
|
43
34
|
|
44
|
-
|
35
|
+
it 'creates a connection with the temporary credentials' do
|
36
|
+
args = {
|
37
|
+
aws_access_key_id: 'key',
|
38
|
+
aws_secret_access_key: 'XXX',
|
39
|
+
aws_session_token: 'the token',
|
40
|
+
region: 'us-west-1'
|
41
|
+
}
|
42
|
+
Fog::AWS::CloudFormation.should_receive(:new).with(args)
|
43
|
+
SimpleDeploy::AWS::CloudFormation.new
|
45
44
|
end
|
46
45
|
|
47
|
-
|
48
|
-
@cf_mock.should_receive(:create_stack).with('my_stack',
|
49
|
-
{ 'Capabilities' => ['CAPABILITY_IAM'],
|
50
|
-
'TemplateBody' => 'my_template',
|
51
|
-
'Parameters' => { 'parameter1' => 'my_param' }
|
52
|
-
}).and_raise(@exception)
|
46
|
+
end
|
53
47
|
|
54
|
-
|
55
|
-
|
56
|
-
|
48
|
+
describe 'with long lived credentials' do
|
49
|
+
include_context 'double stubbed config', :access_key => 'key',
|
50
|
+
:secret_key => 'XXX',
|
51
|
+
:security_token => nil,
|
52
|
+
:temporary_credentials? => false,
|
53
|
+
:region => 'us-west-1'
|
54
|
+
before do
|
55
|
+
@cf_mock = mock 'CloudFormation'
|
56
|
+
Fog::AWS::CloudFormation.stub(:new).and_return(@cf_mock)
|
57
57
|
|
58
|
-
|
59
|
-
should raise_error SimpleDeploy::Exceptions::CloudFormationError
|
58
|
+
@cf = SimpleDeploy::AWS::CloudFormation.new
|
60
59
|
end
|
61
|
-
end
|
62
60
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
61
|
+
describe "create" do
|
62
|
+
it "should create the stack on Cloud Formation" do
|
63
|
+
@cf_mock.should_receive(:create_stack).with('my_stack',
|
64
|
+
{ 'Capabilities' => ['CAPABILITY_IAM'],
|
65
|
+
'TemplateBody' => 'my_template',
|
66
|
+
'Parameters' => { 'parameter1' => 'my_param' }
|
67
|
+
})
|
68
|
+
|
69
|
+
@cf.create(@args)
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should trap and re-raise exceptions as SimpleDeploy::Exceptions::CloudFormationError" do
|
73
|
+
@cf_mock.should_receive(:create_stack).with('my_stack',
|
74
|
+
{ 'Capabilities' => ['CAPABILITY_IAM'],
|
75
|
+
'TemplateBody' => 'my_template',
|
76
|
+
'Parameters' => { 'parameter1' => 'my_param' }
|
77
|
+
}).and_raise(@exception)
|
78
|
+
|
79
|
+
SimpleDeploy::AWS::CloudFormation::Error.should_receive(:new).
|
80
|
+
with(:exception => @exception).
|
81
|
+
and_raise SimpleDeploy::Exceptions::CloudFormationError.new('failed')
|
70
82
|
|
71
|
-
|
72
|
-
|
83
|
+
lambda { @cf.create @args }.
|
84
|
+
should raise_error SimpleDeploy::Exceptions::CloudFormationError
|
85
|
+
end
|
86
|
+
end
|
73
87
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
'
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
with(:exception => @exception).
|
82
|
-
and_raise SimpleDeploy::Exceptions::CloudFormationError.new('failed')
|
83
|
-
|
84
|
-
lambda { @cf.update(@args) }.
|
85
|
-
should raise_error SimpleDeploy::Exceptions::CloudFormationError
|
86
|
-
end
|
87
|
-
end
|
88
|
+
describe "update" do
|
89
|
+
it "should update the stack on Cloud Formation" do
|
90
|
+
@cf_mock.should_receive(:update_stack).with('my_stack',
|
91
|
+
{ 'Capabilities' => ['CAPABILITY_IAM'],
|
92
|
+
'TemplateBody' => 'my_template',
|
93
|
+
'Parameters' => { 'parameter1' => 'my_param' }
|
94
|
+
})
|
88
95
|
|
96
|
+
@cf.update(@args)
|
97
|
+
end
|
89
98
|
|
90
|
-
|
91
|
-
|
92
|
-
|
99
|
+
it "should trap and re-raise exceptions as SimpleDeploy::Exceptions::CloudFormationError" do
|
100
|
+
@cf_mock.should_receive(:update_stack).with('my_stack',
|
101
|
+
{ 'Capabilities' => ['CAPABILITY_IAM'],
|
102
|
+
'TemplateBody' => 'my_template',
|
103
|
+
'Parameters' => { 'parameter1' => 'my_param' }
|
104
|
+
}).and_raise(@exception)
|
105
|
+
SimpleDeploy::AWS::CloudFormation::Error.should_receive(:new).
|
106
|
+
with(:exception => @exception).
|
107
|
+
and_raise SimpleDeploy::Exceptions::CloudFormationError.new('failed')
|
93
108
|
|
94
|
-
|
109
|
+
lambda { @cf.update(@args) }.
|
110
|
+
should raise_error SimpleDeploy::Exceptions::CloudFormationError
|
111
|
+
end
|
95
112
|
end
|
96
113
|
|
97
|
-
it "should trap and re-raise exceptions as SimpleDeploy::Exceptions::CloudFormationError" do
|
98
|
-
@cf_mock.should_receive(:delete_stack).
|
99
|
-
with('my_stack').
|
100
|
-
and_raise @exception
|
101
|
-
SimpleDeploy::AWS::CloudFormation::Error.should_receive(:new).
|
102
|
-
with(:exception => @exception).
|
103
|
-
and_raise SimpleDeploy::Exceptions::CloudFormationError.new('failed')
|
104
114
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
end
|
115
|
+
describe 'destroy' do
|
116
|
+
it "should delete the stack on Cloud Formation" do
|
117
|
+
@cf_mock.should_receive(:delete_stack).with('my_stack')
|
109
118
|
|
119
|
+
@cf.destroy('my_stack')
|
120
|
+
end
|
110
121
|
|
111
|
-
|
112
|
-
|
113
|
-
|
122
|
+
it "should trap and re-raise exceptions as SimpleDeploy::Exceptions::CloudFormationError" do
|
123
|
+
@cf_mock.should_receive(:delete_stack).
|
124
|
+
with('my_stack').
|
125
|
+
and_raise @exception
|
126
|
+
SimpleDeploy::AWS::CloudFormation::Error.should_receive(:new).
|
127
|
+
with(:exception => @exception).
|
128
|
+
and_raise SimpleDeploy::Exceptions::CloudFormationError.new('failed')
|
114
129
|
|
115
|
-
|
130
|
+
lambda { @cf.destroy('my_stack') }.
|
131
|
+
should raise_error SimpleDeploy::Exceptions::CloudFormationError
|
132
|
+
end
|
116
133
|
end
|
117
134
|
|
118
|
-
it "should trap and re-raise exceptions as SimpleDeploy::Exceptions::CloudFormationError" do
|
119
|
-
@cf_mock.should_receive(:describe_stacks).
|
120
|
-
with('StackName' => 'my_stack').
|
121
|
-
and_raise @exception
|
122
|
-
SimpleDeploy::AWS::CloudFormation::Error.should_receive(:new).
|
123
|
-
with(:exception => @exception).
|
124
|
-
and_raise SimpleDeploy::Exceptions::CloudFormationError.new('failed')
|
125
135
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
end
|
136
|
+
describe 'describe_stack' do
|
137
|
+
it "should return the Cloud Formation description of the stack" do
|
138
|
+
@cf_mock.should_receive(:describe_stacks).with('StackName' => 'my_stack').and_return(@response_stub)
|
130
139
|
|
131
|
-
|
132
|
-
|
133
|
-
@cf_mock.should_receive(:describe_stack_resources).with('StackName' => 'my_stack').and_return(@response_stub)
|
140
|
+
@cf.describe_stack('my_stack').should == [{'StackStatus' => 'green', 'Outputs' => [{'key' => 'value'}]}]
|
141
|
+
end
|
134
142
|
|
135
|
-
|
143
|
+
it "should trap and re-raise exceptions as SimpleDeploy::Exceptions::CloudFormationError" do
|
144
|
+
@cf_mock.should_receive(:describe_stacks).
|
145
|
+
with('StackName' => 'my_stack').
|
146
|
+
and_raise @exception
|
147
|
+
SimpleDeploy::AWS::CloudFormation::Error.should_receive(:new).
|
148
|
+
with(:exception => @exception).
|
149
|
+
and_raise SimpleDeploy::Exceptions::CloudFormationError.new('failed')
|
150
|
+
|
151
|
+
lambda { @cf.describe_stack('my_stack') }.
|
152
|
+
should raise_error SimpleDeploy::Exceptions::CloudFormationError
|
153
|
+
end
|
136
154
|
end
|
137
155
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
and_raise @exception
|
142
|
-
SimpleDeploy::AWS::CloudFormation::Error.should_receive(:new).
|
143
|
-
with(:exception => @exception).
|
144
|
-
and_raise SimpleDeploy::Exceptions::CloudFormationError.new('failed')
|
156
|
+
describe "stack_resources" do
|
157
|
+
it "should return the Cloud Formation description of the stack resources" do
|
158
|
+
@cf_mock.should_receive(:describe_stack_resources).with('StackName' => 'my_stack').and_return(@response_stub)
|
145
159
|
|
146
|
-
|
147
|
-
|
148
|
-
end
|
149
|
-
end
|
160
|
+
@cf.stack_resources('my_stack').should == [{'StackName' => 'my_stack'}]
|
161
|
+
end
|
150
162
|
|
151
|
-
|
152
|
-
|
153
|
-
|
163
|
+
it "should trap and re-raise exceptions as SimpleDeploy::Exceptions::CloudFormationError" do
|
164
|
+
@cf_mock.should_receive(:describe_stack_resources).
|
165
|
+
with('StackName' => 'my_stack').
|
166
|
+
and_raise @exception
|
167
|
+
SimpleDeploy::AWS::CloudFormation::Error.should_receive(:new).
|
168
|
+
with(:exception => @exception).
|
169
|
+
and_raise SimpleDeploy::Exceptions::CloudFormationError.new('failed')
|
154
170
|
|
155
|
-
|
171
|
+
lambda { @cf.stack_resources('my_stack') }.
|
172
|
+
should raise_error SimpleDeploy::Exceptions::CloudFormationError
|
173
|
+
end
|
156
174
|
end
|
157
175
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
and_raise @exception
|
176
|
+
describe "stack_events" do
|
177
|
+
it "should return the Cloud Formation description of the stack events" do
|
178
|
+
@cf_mock.should_receive(:describe_stack_events).with('my_stack').and_return(@response_stub)
|
162
179
|
|
163
|
-
|
164
|
-
|
165
|
-
and_raise SimpleDeploy::Exceptions::CloudFormationError.new('failed')
|
180
|
+
@cf.stack_events('my_stack', 2).should == ['event1', 'event2']
|
181
|
+
end
|
166
182
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
183
|
+
it "should trap and re-raise exceptions as SimpleDeploy::Exceptions::CloudFormationError" do
|
184
|
+
@cf_mock.should_receive(:describe_stack_events).
|
185
|
+
with('my_stack').
|
186
|
+
and_raise @exception
|
171
187
|
|
172
|
-
|
173
|
-
|
174
|
-
|
188
|
+
SimpleDeploy::AWS::CloudFormation::Error.should_receive(:new).
|
189
|
+
with(:exception => @exception).
|
190
|
+
and_raise SimpleDeploy::Exceptions::CloudFormationError.new('failed')
|
175
191
|
|
176
|
-
|
192
|
+
lambda { @cf.stack_events('my_stack', 2) }.
|
193
|
+
should raise_error SimpleDeploy::Exceptions::CloudFormationError
|
194
|
+
end
|
177
195
|
end
|
178
|
-
end
|
179
196
|
|
180
|
-
|
181
|
-
|
182
|
-
|
197
|
+
describe "stack_status" do
|
198
|
+
it "should return the Cloud Formation status of the stack" do
|
199
|
+
@cf_mock.should_receive(:describe_stacks).with('StackName' => 'my_stack').and_return(@response_stub)
|
183
200
|
|
184
|
-
|
201
|
+
@cf.stack_status('my_stack').should == 'green'
|
202
|
+
end
|
185
203
|
end
|
186
|
-
end
|
187
204
|
|
188
|
-
|
189
|
-
|
190
|
-
|
205
|
+
describe "stack_outputs" do
|
206
|
+
it "should return the Cloud Formation outputs for the stack" do
|
207
|
+
@cf_mock.should_receive(:describe_stacks).with('StackName' => 'my_stack').and_return(@response_stub)
|
191
208
|
|
192
|
-
|
209
|
+
@cf.stack_outputs('my_stack').should == [{'key' => 'value'}]
|
210
|
+
end
|
193
211
|
end
|
194
212
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
and_raise SimpleDeploy::Exceptions::CloudFormationError.new('failed')
|
213
|
+
describe "template" do
|
214
|
+
it "should return the Cloud Formation template for the stack" do
|
215
|
+
@cf_mock.should_receive(:get_template).with('my_stack').and_return(@response_stub)
|
216
|
+
|
217
|
+
@cf.template('my_stack').should == '{EIP: "string"}'
|
218
|
+
end
|
202
219
|
|
203
|
-
|
204
|
-
|
220
|
+
it "should trap and re-raise exceptions as SimpleDeploy::Exceptions::CloudFormationError" do
|
221
|
+
@cf_mock.should_receive(:get_template).
|
222
|
+
with('my_stack').
|
223
|
+
and_raise @exception
|
224
|
+
SimpleDeploy::AWS::CloudFormation::Error.should_receive(:new).
|
225
|
+
with(:exception => @exception).
|
226
|
+
and_raise SimpleDeploy::Exceptions::CloudFormationError.new('failed')
|
227
|
+
|
228
|
+
lambda { @cf.template('my_stack') }.
|
229
|
+
should raise_error SimpleDeploy::Exceptions::CloudFormationError
|
230
|
+
end
|
205
231
|
end
|
206
232
|
end
|
233
|
+
|
207
234
|
end
|