jackal-cfn 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -0,0 +1,6 @@
1
+ # v0.1.2
2
+ * Include request id in response content
3
+ * Allow matching on class name to custom resource type
4
+
5
+ # v0.1.0
6
+ * Initial commit
@@ -25,11 +25,11 @@ module Jackal
25
25
  #
26
26
  # @param message [Carnivore::Message]
27
27
  # @return [Truthy, Falsey]
28
- def valid?(message)
29
- super do |payload|
30
- payload.get('ResourceProperties', 'Action') == 'hash_extractor'
31
- end
32
- end
28
+ # def valid?(message)
29
+ # super do |payload|
30
+ # payload.get('ResourceProperties', 'Action') == 'hash_extractor'
31
+ # end
32
+ # end
33
33
 
34
34
  # Process message, send value back to CFN
35
35
  #
@@ -28,8 +28,9 @@ module Jackal
28
28
  'LogicalResourceId' => args[:logical_resource_id],
29
29
  'PhysicalResourceId' => args.fetch(:physical_resource_id, physical_resource_id),
30
30
  'StackId' => args[:stack_id],
31
+ 'RequestId' => args[:request_id],
31
32
  'Status' => 'SUCCESS',
32
- 'Reason' => nil,
33
+ 'Reason' => 'Not provided',
33
34
  'Data' => Smash.new
34
35
  )
35
36
  end
@@ -64,7 +65,7 @@ module Jackal
64
65
  connection = response_endpoint(url.host, url.scheme)
65
66
  path = "#{url.path}?#{url.query}"
66
67
  debug "Custom resource response data: #{response.inspect}"
67
- complete = connection.request(:put, path, {}, :data => JSON.dump(response))
68
+ complete = connection.put(path, JSON.dump(response))
68
69
  case complete.status
69
70
  when 200
70
71
  info "Custom resource response complete! (Sent to: #{url})"
@@ -102,8 +103,10 @@ module Jackal
102
103
  # @return [TrueClass, FalseClass]
103
104
  def valid?(message)
104
105
  super do |payload|
106
+ resource_type = payload['ResourceType'].split('::').last
105
107
  result = payload[:origin_type] == 'Notification' &&
106
- payload[:origin_subject].downcase.include?('cloudformation custom resource')
108
+ payload[:origin_subject].downcase.include?('cloudformation custom resource') &&
109
+ (resource_type == 'CustomResource' || resource_type == self.class.name.split('::').last)
107
110
  if(result && block_given?)
108
111
  yield payload
109
112
  else
@@ -1,6 +1,6 @@
1
1
  module Jackal
2
2
  module Cfn
3
3
  # Current version
4
- VERSION = Gem::Version.new('0.1.0')
4
+ VERSION = Gem::Version.new('0.1.2')
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jackal-cfn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-03 00:00:00.000000000 Z
12
+ date: 2014-07-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jackal