stackup 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/stackup +29 -16
- data/lib/stackup/stack.rb +35 -13
- data/pkg/stackup-0.3.0.gem +0 -0
- data/stackup.gemspec +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b649897af4dba63a33163c2c265e71e3883b73c
|
4
|
+
data.tar.gz: fb24cad02b8e50e5f7ee2f6411b7faa64cc18d3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68f9c58d118c8d766c4e2837bf8c0846fe08f240dbedf583d30fe3637554bbfa23efe320239ea29a5d8eb84b9890982ff6dac852ccdbcae437efc37da531e802
|
7
|
+
data.tar.gz: cf8dde6a511662558fc0a0a77f6ded5dc5d4d978c9e83c729f4b1fb80f3f59ec6165e952f17beb46279c0e0a55fa77c14b5a34b68dd3a48f96d5834036afe09c
|
data/Gemfile.lock
CHANGED
data/bin/stackup
CHANGED
@@ -78,19 +78,32 @@ Clamp do
|
|
78
78
|
|
79
79
|
subcommand "up", "Create/update the stack" do
|
80
80
|
|
81
|
-
option "
|
81
|
+
option ["-t", "--template"], "FILE", "template file",
|
82
|
+
:attribute_name => :template_file
|
82
83
|
|
83
|
-
|
84
|
-
|
84
|
+
option ["-T", "--use-previous-template"], :flag,
|
85
|
+
"reuse the existing template"
|
85
86
|
|
86
|
-
|
87
|
-
|
87
|
+
option ["-p", "--parameters"], "FILE", "parameters file",
|
88
|
+
:attribute_name => :parameters_file
|
89
|
+
|
90
|
+
option "--policy", "FILE", "stack policy file",
|
91
|
+
:attribute_name => :policy_file
|
92
|
+
|
93
|
+
option "--on-failure", "ACTION",
|
94
|
+
"when stack creation fails: DO_NOTHING, ROLLBACK, or DELETE",
|
95
|
+
:default => "ROLLBACK"
|
88
96
|
|
89
97
|
def execute
|
98
|
+
unless template_file || use_previous_template?
|
99
|
+
signal_usage_error "Specify either --template or --use-previous-template"
|
100
|
+
end
|
90
101
|
options = {}
|
91
|
-
options[:template] =
|
92
|
-
options[:
|
93
|
-
options[:
|
102
|
+
options[:template] = load_data(template_file) if template_file
|
103
|
+
options[:on_failure] = on_failure
|
104
|
+
options[:parameters] = load_data(parameters_file) if parameters_file
|
105
|
+
options[:stack_policy] = load_data(policy_file) if policy_file
|
106
|
+
options[:use_previous_template] = use_previous_template?
|
94
107
|
report_change do
|
95
108
|
stack.create_or_update(options)
|
96
109
|
end
|
@@ -104,14 +117,6 @@ Clamp do
|
|
104
117
|
signal_error "no such file: #{file.inspect}"
|
105
118
|
end
|
106
119
|
|
107
|
-
def template
|
108
|
-
@template ||= load_data(template_file)
|
109
|
-
end
|
110
|
-
|
111
|
-
def parameters
|
112
|
-
@parameters ||= load_data(parameters_file) if parameters_file
|
113
|
-
end
|
114
|
-
|
115
120
|
end
|
116
121
|
|
117
122
|
subcommand ["down", "delete"], "Remove the stack." do
|
@@ -134,6 +139,14 @@ Clamp do
|
|
134
139
|
|
135
140
|
end
|
136
141
|
|
142
|
+
subcommand "wait", "Wait until stack is stable" do
|
143
|
+
|
144
|
+
def execute
|
145
|
+
puts stack.wait
|
146
|
+
end
|
147
|
+
|
148
|
+
end
|
149
|
+
|
137
150
|
subcommand "template", "Display stack template." do
|
138
151
|
|
139
152
|
def execute
|
data/lib/stackup/stack.rb
CHANGED
@@ -19,7 +19,7 @@ module Stackup
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
attr_reader :name
|
22
|
+
attr_reader :name
|
23
23
|
|
24
24
|
# Register a handler for reporting of stack events.
|
25
25
|
# @param [Proc] event_handler
|
@@ -62,23 +62,27 @@ module Stackup
|
|
62
62
|
# if true, disable rollback if stack creation fails
|
63
63
|
# @option options [String] :notification_arns
|
64
64
|
# ARNs for the Amazon SNS topics associated with this stack
|
65
|
-
# @option options [String] :on_failure (
|
65
|
+
# @option options [String] :on_failure (ROLLBACK)
|
66
66
|
# if stack creation fails: DO_NOTHING, ROLLBACK, or DELETE
|
67
67
|
# @option options [Hash, Array<Hash>] :parameters
|
68
68
|
# stack parameters, either as a Hash, or as an Array of
|
69
69
|
# +Aws::CloudFormation::Types::Parameter+ structures
|
70
70
|
# @option options [Array<String>] :resource_types
|
71
71
|
# resource types that you have permissions to work with
|
72
|
-
# @option options [Hash] :
|
73
|
-
# stack
|
72
|
+
# @option options [Hash] :stack_policy
|
73
|
+
# stack policy, as Ruby data
|
74
74
|
# @option options [String] :stack_policy_body
|
75
75
|
# stack policy, as JSON
|
76
76
|
# @option options [String] :stack_policy_url
|
77
77
|
# location of stack policy
|
78
|
+
# @option options [Hash] :stack_policy_during_update
|
79
|
+
# temporary stack policy, as Ruby data
|
78
80
|
# @option options [String] :stack_policy_during_update_body
|
79
81
|
# temporary stack policy, as JSON
|
80
82
|
# @option options [String] :stack_policy_during_update_url
|
81
83
|
# location of temporary stack policy
|
84
|
+
# @option options [Hash] :template
|
85
|
+
# stack template, as Ruby data
|
82
86
|
# @option options [String] :template_body
|
83
87
|
# stack template, as JSON
|
84
88
|
# @option options [String] :template_url
|
@@ -98,6 +102,12 @@ module Stackup
|
|
98
102
|
if (parameters = options[:parameters])
|
99
103
|
options[:parameters] = normalise_parameters(parameters)
|
100
104
|
end
|
105
|
+
if (policy_data = options.delete(:stack_policy))
|
106
|
+
options[:stack_policy_body] = MultiJson.dump(policy_data)
|
107
|
+
end
|
108
|
+
if (policy_data = options.delete(:stack_policy_during_update))
|
109
|
+
options[:stack_policy_during_update_body] = MultiJson.dump(policy_data)
|
110
|
+
end
|
101
111
|
options[:capabilities] ||= ["CAPABILITY_IAM"]
|
102
112
|
delete if ALMOST_DEAD_STATUSES.include?(status)
|
103
113
|
update(options)
|
@@ -150,6 +160,16 @@ module Stackup
|
|
150
160
|
nil
|
151
161
|
end
|
152
162
|
|
163
|
+
# Wait until stack reaches a stable state
|
164
|
+
#
|
165
|
+
# @return [String] status, once stable
|
166
|
+
#
|
167
|
+
def wait
|
168
|
+
modify_stack do
|
169
|
+
# nothing
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
153
173
|
# Get the current template.
|
154
174
|
#
|
155
175
|
# @return [Hash] current stack template, as Ruby data
|
@@ -210,6 +230,17 @@ module Stackup
|
|
210
230
|
|
211
231
|
private
|
212
232
|
|
233
|
+
attr_reader :cf_client
|
234
|
+
|
235
|
+
def cf
|
236
|
+
Aws::CloudFormation::Resource.new(:client => cf_client)
|
237
|
+
end
|
238
|
+
|
239
|
+
def cf_stack
|
240
|
+
id_or_name = @stack_id || name
|
241
|
+
cf.stack(id_or_name)
|
242
|
+
end
|
243
|
+
|
213
244
|
def create(options)
|
214
245
|
options[:stack_name] = name
|
215
246
|
options.delete(:stack_policy_during_update_body)
|
@@ -239,15 +270,6 @@ module Stackup
|
|
239
270
|
@logger ||= Logger.new($stdout).tap { |l| l.level = Logger::INFO }
|
240
271
|
end
|
241
272
|
|
242
|
-
def cf
|
243
|
-
Aws::CloudFormation::Resource.new(:client => cf_client)
|
244
|
-
end
|
245
|
-
|
246
|
-
def cf_stack
|
247
|
-
id_or_name = @stack_id || name
|
248
|
-
cf.stack(id_or_name)
|
249
|
-
end
|
250
|
-
|
251
273
|
def event_handler
|
252
274
|
@event_handler ||= lambda do |e|
|
253
275
|
fields = [e.logical_resource_id, e.resource_status, e.resource_status_reason]
|
Binary file
|
data/stackup.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
|
6
6
|
spec.name = "stackup"
|
7
|
-
spec.version = "0.
|
7
|
+
spec.version = "0.4.0"
|
8
8
|
spec.authors = ["Mike Williams", "Arvind Kunday"]
|
9
9
|
spec.email = ["mike.williams@rea-group.com", "arvind.kunday@rea-group.com"]
|
10
10
|
spec.summary = "Manage CloudFormation stacks"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stackup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Williams
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-10-
|
12
|
+
date: 2015-10-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- lib/stackup/stack.rb
|
113
113
|
- lib/stackup/stack_watcher.rb
|
114
114
|
- pkg/stackup-0.2.0.gem
|
115
|
+
- pkg/stackup-0.3.0.gem
|
115
116
|
- spec/spec_helper.rb
|
116
117
|
- spec/stackup/stack_spec.rb
|
117
118
|
- spec/stackup/stack_watcher_spec.rb
|