jackal-cfn 0.2.10 → 0.2.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9fddaa1ca5447da20d6c856d2ccdf3ba4d3c89d9
4
- data.tar.gz: acddccbce932860d09c048ba04627df5744cd4b3
3
+ metadata.gz: 779e84f842e3df3adf70f9d2c9a2c55bbb062484
4
+ data.tar.gz: fb6805a786d7de928113fa0de6ce78a68cc33f89
5
5
  SHA512:
6
- metadata.gz: 6d5f2187fab6e8d42da3ab3351b53720b1cd351a95df76ffe40390e50786a4f457fef306f6b00b93de1dabba807bcdb1f87e1c0c5b08b67d3f9dd8985d6c5b86
7
- data.tar.gz: 9b5b9c770c12c9158bdc2ad3bf03041b7200b3aacdaf35f2bbec8c561673646d0b1a2ec63d1acea196e8b246b29468397497291f6b7fb006e6ac96359e2447f6
6
+ metadata.gz: 67a24a6d9a127847b38c53ddbf944acd089d784989ee728f9671ef6864b8b7bc7dc2aa81cd02382ee95a8795a98f794fc1f4bebbf7304187d90677644e926d76
7
+ data.tar.gz: 95e1c39a4764e165983b3034769c0274345bfe5854e75098ef93c7de196128146b938fedf0fd7fb1bebeb5454854be72762385b487c7d2bdf597b20a83469c82
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v0.2.12
2
+ * Update joiner used for physical resource ID in JackalStack
3
+ * Support stack delete when create is incomplete
4
+
1
5
  # v0.2.10
2
6
  * Properly handle no parameters in properties
3
7
  * Add new JackalStack resource
@@ -34,6 +34,8 @@ module Jackal
34
34
  # }
35
35
  class JackalStack < Jackal::Cfn::Resource
36
36
 
37
+ LOCATION_JOINER = '__~__'
38
+
37
39
  # Load miasma for stack building
38
40
  def setup(*_)
39
41
  require 'miasma'
@@ -114,6 +116,18 @@ module Jackal
114
116
  )
115
117
  end
116
118
 
119
+ # Generate the remote stack name via the resource information
120
+ #
121
+ # @param resource [Hash]
122
+ # @return [String]
123
+ def generate_stack_name(resource)
124
+ [
125
+ 'JackalStack',
126
+ resource[:logical_resource_id],
127
+ resource[:stack_id].split('/').last
128
+ ].join('-')
129
+ end
130
+
117
131
  # Create a new stack and update the response values
118
132
  #
119
133
  # @param response [Hash] response data of action
@@ -124,11 +138,7 @@ module Jackal
124
138
  # @return [TrueClass, FalseClass]
125
139
  def create_stack(response, resource, properties, parameters, message)
126
140
  stack = remote_api(properties[:location]).stacks.build(
127
- :name => [
128
- 'JackalStack',
129
- resource[:logical_resource_id],
130
- resource[:stack_id].split('/').last
131
- ].join('-'),
141
+ :name => generate_stack_name(resource),
132
142
  :template => properties.fetch(:stack, fetch_template(properties[:template_url])),
133
143
  :parameters => Hash[parameters.map{|k,v| [Bogo::Utility.camel(k), v] }]
134
144
  )
@@ -143,7 +153,10 @@ module Jackal
143
153
  stack.outputs.each do |output|
144
154
  response['Data']["Outputs.#{output.key}"] = output.value
145
155
  end
146
- response['PhysicalResourceId'] = "#{properties[:location]}-#{stack.id}"
156
+ response['PhysicalResourceId'] = [
157
+ properties[:location],
158
+ stack.id
159
+ ].join(LOCATION_JOINER)
147
160
  true
148
161
  else
149
162
  response['Status'] = 'FAILED'
@@ -207,6 +220,15 @@ module Jackal
207
220
  # @param message [Carnivore::Message] original message
208
221
  def destroy_stack(response, resource, message)
209
222
  stack = request_destroy(resource[:physical_resource_id])
223
+ unless(stack)
224
+ properties = rekey_hash(cfn_resource[:resource_properties])
225
+ stack = request_destroy(
226
+ [
227
+ properties[:location],
228
+ generate_stack_name(resource)
229
+ ].join(LOCATION_JOINER)
230
+ )
231
+ end
210
232
  if(stack)
211
233
  until(stack.state.nil? || stack.state.to_s.end_with?('complete') || stack.state.to_s.end_with?('failed'))
212
234
  info "Waiting for stack destruction (#{stack.name})..."
@@ -226,7 +248,7 @@ module Jackal
226
248
  # @param stack_resource_id [String] physical resource ID
227
249
  # @return [Miasma::Models::Orchestration::Stack, FalseClass]
228
250
  def request_destroy(stack_resource_id)
229
- location, stack_id = stack_resource_id.split('-', 2)
251
+ location, stack_id = stack_resource_id.split(LOCATION_JOINER, 2)
230
252
  if(stack_id)
231
253
  begin
232
254
  info "Sending stack destruction request to: #{stack_id} in: #{location}"
@@ -69,7 +69,7 @@ module Jackal
69
69
  # @note this should be overridden in subclasses when actual
70
70
  # resources are being created
71
71
  def physical_resource_id
72
- "#{self.class.name.split('::').last}-#{Celluloid.uuid}"
72
+ "#{self.class.name.split('::').last}-#{Carnivore.uuid}"
73
73
  end
74
74
 
75
75
  # Generate response hash
@@ -59,7 +59,7 @@ module Jackal
59
59
  )
60
60
  )
61
61
  )
62
- result = sts.assume_role("jackal-cfn-#{Celluloid.uuid}", role).body
62
+ result = sts.assume_role("jackal-cfn-#{Carnivore.uuid}", role).body
63
63
  Thread.current[:cfn_assume_apis][key] = Smash.new(
64
64
  :expires => Time.parse(result['Expiration']).to_i,
65
65
  :api => api.class.new(
@@ -1,6 +1,6 @@
1
1
  module Jackal
2
2
  module Cfn
3
3
  # Current version
4
- VERSION = Gem::Version.new('0.2.10')
4
+ VERSION = Gem::Version.new('0.2.12')
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jackal-cfn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.10
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-08 00:00:00.000000000 Z
11
+ date: 2015-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jackal
@@ -95,9 +95,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  version: '0'
96
96
  requirements: []
97
97
  rubyforge_project:
98
- rubygems_version: 2.2.2
98
+ rubygems_version: 2.4.8
99
99
  signing_key:
100
100
  specification_version: 4
101
101
  summary: Message processing helper
102
102
  test_files: []
103
- has_rdoc: