cloudformation_wrapper 0.2.4 → 0.2.5
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/lib/cloudformation_wrapper/stack_manager.rb +12 -12
- data/lib/cloudformation_wrapper/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c61fa879a2e1ccf5daae26bc45627c71b600b9c674b727c08d45adb99b4f4b8
|
4
|
+
data.tar.gz: 00d392c92f15dc87004dbdd6280edfbfcd682716355775eaec67c96c62fee7c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac763f5324df8374b35d2e1cab5e460aa1ebf341c06a2a4368af896f666fe84c8c2ee4599cc3f6d0bbf61a82e0abfd33c3b54a9b9d53d2e7f11a74e6bf7ec71e
|
7
|
+
data.tar.gz: 060c4856fdf49b3a471d5958a851f40c2d8f924b7ec37eb158dc1d6db58e4cf34ad63284d9cc00b9ce67b440ac5a20f522ec4cb842fec49f193a36247d8ee351
|
@@ -3,7 +3,7 @@ module CloudFormationWrapper
|
|
3
3
|
# Class containing static convenience methods for deploying and managing CloudFormation Stacks.
|
4
4
|
# @since 1.0
|
5
5
|
class StackManager
|
6
|
-
def self.deploy(options)
|
6
|
+
def self.self.deploy(options)
|
7
7
|
unless options[:client]
|
8
8
|
access_key_id = options[:access_key_id] || ENV['AWS_ACCESS_KEY_ID'] || ENV['ACCESS_KEY'] ||
|
9
9
|
raise(ArgumentError, 'Cannot find AWS Access Key ID.')
|
@@ -34,7 +34,7 @@ module CloudFormationWrapper
|
|
34
34
|
|
35
35
|
private
|
36
36
|
|
37
|
-
def verify_options(options)
|
37
|
+
def self.verify_options(options)
|
38
38
|
defaults = {
|
39
39
|
description: 'Deployed with CloudFormation Wrapper.', parameters: {}, wait_for_stack: true
|
40
40
|
}
|
@@ -57,13 +57,13 @@ module CloudFormationWrapper
|
|
57
57
|
raise ArgumentError, 'name must be provided (String)'
|
58
58
|
end
|
59
59
|
|
60
|
-
def ensure_template_file_exists(template_path, cf_client)
|
60
|
+
def self.ensure_template_file_exists(template_path, cf_client)
|
61
61
|
raise ArgumentError, 'CF Template File does not exist.' unless File.file?(template_path)
|
62
62
|
cf_client.validate_template(template_body: File.read(template_path))
|
63
63
|
puts 'Valid Template File.'
|
64
64
|
end
|
65
65
|
|
66
|
-
def deploy_stack(parameters, stack_name, template_path, cf_client, _wait)
|
66
|
+
def self.deploy_stack(parameters, stack_name, template_path, cf_client, _wait)
|
67
67
|
template_parameters = construct_template_parameters(parameters)
|
68
68
|
client_token = ENV.fetch('BUILD_NUMBER', SecureRandom.uuid.delete('-'))
|
69
69
|
old_stack = describe_stack(stack_name, cf_client)
|
@@ -100,7 +100,7 @@ module CloudFormationWrapper
|
|
100
100
|
return_outputs(updated_stack)
|
101
101
|
end
|
102
102
|
|
103
|
-
def construct_template_parameters(parameters)
|
103
|
+
def self.construct_template_parameters(parameters)
|
104
104
|
template_parameters = []
|
105
105
|
parameters.each do |k, v|
|
106
106
|
template_parameters.push(
|
@@ -111,7 +111,7 @@ module CloudFormationWrapper
|
|
111
111
|
template_parameters
|
112
112
|
end
|
113
113
|
|
114
|
-
def describe_stack(stack_name, cf_client)
|
114
|
+
def self.describe_stack(stack_name, cf_client)
|
115
115
|
response = cf_client.describe_stacks(stack_name: stack_name)
|
116
116
|
return false if response.stacks.length != 1
|
117
117
|
return response.stacks[0]
|
@@ -119,7 +119,7 @@ module CloudFormationWrapper
|
|
119
119
|
return false
|
120
120
|
end
|
121
121
|
|
122
|
-
def wait_for_stack_change_set_creation(change_set_id, cf_client)
|
122
|
+
def self.wait_for_stack_change_set_creation(change_set_id, cf_client)
|
123
123
|
polling_period = 1 # second
|
124
124
|
|
125
125
|
puts "Waiting for the Change Set (#{change_set_id}) to be reviewed..."
|
@@ -139,7 +139,7 @@ module CloudFormationWrapper
|
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
142
|
-
def list_changes(change_set_id, cf_client)
|
142
|
+
def self.list_changes(change_set_id, cf_client)
|
143
143
|
response = cf_client.describe_change_set(change_set_name: change_set_id)
|
144
144
|
puts
|
145
145
|
puts 'Stack Set Changes:'
|
@@ -163,7 +163,7 @@ module CloudFormationWrapper
|
|
163
163
|
puts
|
164
164
|
end
|
165
165
|
|
166
|
-
def execute_change_set(change_set_id, cf_client)
|
166
|
+
def self.execute_change_set(change_set_id, cf_client)
|
167
167
|
puts 'Executing Change Set...'
|
168
168
|
|
169
169
|
client_token = ENV.fetch('BUILD_NUMBER', SecureRandom.uuid.delete('-'))
|
@@ -171,7 +171,7 @@ module CloudFormationWrapper
|
|
171
171
|
cf_client.execute_change_set(change_set_name: change_set_id, client_request_token: client_token)
|
172
172
|
end
|
173
173
|
|
174
|
-
def wait_for_stack_to_complete(stack_name, minimum_timestamp_for_events, cf_client)
|
174
|
+
def self.wait_for_stack_to_complete(stack_name, minimum_timestamp_for_events, cf_client)
|
175
175
|
timestamp_width = 30
|
176
176
|
logical_resource_width = 40
|
177
177
|
resource_status_width = 40
|
@@ -207,7 +207,7 @@ module CloudFormationWrapper
|
|
207
207
|
stack
|
208
208
|
end
|
209
209
|
|
210
|
-
def get_latest_events(stack_name, minimum_timestamp_for_events, most_recent_event_id, cf_client)
|
210
|
+
def self.get_latest_events(stack_name, minimum_timestamp_for_events, most_recent_event_id, cf_client)
|
211
211
|
no_new_events = false
|
212
212
|
response = nil
|
213
213
|
events = []
|
@@ -233,7 +233,7 @@ module CloudFormationWrapper
|
|
233
233
|
events
|
234
234
|
end
|
235
235
|
|
236
|
-
def return_outputs(stack)
|
236
|
+
def self.return_outputs(stack)
|
237
237
|
return if stack.outputs.empty?
|
238
238
|
|
239
239
|
output_name_width = 30
|