hiera-cloudformation 0.0.2 → 0.0.3

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: 1eba584b63db610211319c070fe1d0d6d4c1f087
4
- data.tar.gz: dc817b92d7a69caedcc5d771e9c1371dd8254156
3
+ metadata.gz: 3d0724da98db4ac624ba1f132f45c12f1ff32ee9
4
+ data.tar.gz: 09d435a80b6401454bd1ff42a941a733c5a8373b
5
5
  SHA512:
6
- metadata.gz: 24d92d0ba85721c8fcb5aed60992128583762309dae4f68a2053b57970de074996044c8039ab5188b0a3dcddad0a4a641468dc9bdf891c814ce62c7994257356
7
- data.tar.gz: abdfcc7971cbf4930b1236092878fd7ac3bb195d750aeaf1bba62c521aa931b2e12050e11907eace114a4279fbd26649d74801fa382c64a4f1d1d95d04ce67b9
6
+ metadata.gz: 755afa1e3b436af2c63c58c51d9953b806c27a1ecf86d5bca5cdfdba0f99481a47229746f76c22f5aa20eca68cdedb22ec5dbeff714f8a9569d45cdc2ca01db3
7
+ data.tar.gz: 537b01e5b8d1e08850dfcbc4df3068ec3f936efe98e3e5f5840cc7cfdc48e0e3fd8aadeb415a21409e5560d7ebb6813f025aaf151ecefe18d14e70a1ed36a13a
@@ -1,4 +1,4 @@
1
- Copyright 2013-2014 FanDuel Ltd.
1
+ Copyright 2013-2015 FanDuel Ltd.
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
data/README.md CHANGED
@@ -25,6 +25,22 @@ To provide the backend with an AWS access key, you can add the following configu
25
25
  :access_key_id: Your_AWS_Access_Key_ID_Here
26
26
  :secret_access_key: Your_AWS_Secret_Access_Key_Here
27
27
 
28
+ The data fetched from the CloudFormation API will be cached. By default this is a process local cache
29
+ which is persisted for 60 seconds. You may also store cached data in a Redis server and optionally
30
+ make the data persistent by setting a cache_ttl of < 1. To configure for Redis add the following
31
+ configuration to the `:cloudformation` section in hiera.yaml (`:redis_port` and `:redis_db` settings
32
+ are optional and will default to the values shown.
33
+
34
+ :cloudformation:
35
+ :redis_hostname: Your_Redis_Hostname_Or_IP_Address
36
+ :redis_port: 6379
37
+ :redis_db: 0
38
+ :cache_ttl: -1
39
+
40
+ If you set the cache_ttl so that data is not expired from the cache you should have some other
41
+ mechanism to keep the cache updated and cleaned of old keys. One way is to have a process CloudFormation
42
+ SNS/SQS events and insert, update and delete keys from the cache as stacks events take place.
43
+
28
44
  If you do not add these keys to your configuration file, the access keys will be looked up from
29
45
  the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables, or from an IAM
30
46
  instance role (if you are running Hiera on an EC2 instance with an IAM role assigned).
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright 2013-2014 FanDuel Ltd.
2
+ Copyright 2013-2015 FanDuel Ltd.
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@ require 'rake/testtask'
20
20
 
21
21
  spec = Gem::Specification.new do |gem|
22
22
  gem.name = "hiera-cloudformation"
23
- gem.version = '0.0.2'
23
+ gem.version = '0.0.3'
24
24
  gem.authors = ["Hugh Cole-Baker"]
25
25
  gem.email = ["hugh@fanduel.com"]
26
26
  gem.summary = %q{CloudFormation backend for Hiera}
@@ -37,6 +37,7 @@ spec = Gem::Specification.new do |gem|
37
37
  gem.add_runtime_dependency "aws-sdk", "~> 1.11.2"
38
38
  gem.add_runtime_dependency "timedcache", "~> 0.4.0"
39
39
  gem.add_runtime_dependency "json", "~> 1.8.0"
40
+ gem.add_runtime_dependency "redis", "~> 3.2.1"
40
41
  end
41
42
 
42
43
  Gem::PackageTask.new(spec) do |pkg|
@@ -1,187 +1,273 @@
1
- =begin
2
- Copyright 2013-2014 FanDuel Ltd.
1
+ # Copyright 2013-2015 FanDuel Ltd.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
3
14
 
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
15
+ require 'rubygems'
16
+ require 'aws'
17
+ require 'timedcache'
18
+ require 'redis'
19
+ require 'json'
7
20
 
8
- http://www.apache.org/licenses/LICENSE-2.0
21
+ class Hiera
22
+ module Backend
23
+ # Cache class that hides Redis vs. TimedCache implementation
24
+ class Cache
25
+ def initialize(cache_ttl = 60)
26
+ @cache_ttl = cache_ttl
9
27
 
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- =end
28
+ if Config.include?(:cloudformation) && !Config[:cloudformation].nil?
29
+ if Config[:cloudformation].include?(:redis_host)
30
+ @redis_host = Config[:cloudformation][:redis_host]
31
+ end
16
32
 
17
- class Hiera
18
- module Backend
19
- class Cloudformation_backend
20
- TIMEOUT = 60 # 1 minute timeout for AWS API response caching
21
-
22
- def initialize
23
- begin
24
- require 'aws'
25
- require 'timedcache'
26
- require 'json'
27
- rescue LoadError
28
- require 'rubygems'
29
- require 'aws'
30
- require 'timedcache'
31
- require 'json'
32
- end
33
-
34
- if Config.include?(:cloudformation) && !Config[:cloudformation].nil? then
35
- if Config[:cloudformation].fetch(:parse_metadata, false) then
36
- Hiera.debug("Will convert CloudFormation stringified metadata back to numbers or booleans.")
37
- @parse_metadata = true
38
- else
39
- @parse_metadata = false
40
- end
41
-
42
- aws_config = {}
43
- if Config[:cloudformation].include?(:access_key_id) && Config[:cloudformation].include?(:secret_access_key) then
44
- Hiera.debug("Found AWS access key #{Config[:cloudformation][:access_key_id]} from configuration")
45
- aws_config[:access_key_id] = Config[:cloudformation][:access_key_id]
46
- aws_config[:secret_access_key] = Config[:cloudformation][:secret_access_key]
47
- end
48
- if Config[:cloudformation].include?(:region) then
49
- Hiera.debug("Found AWS region #{Config[:cloudformation][:region]} from configuration")
50
- aws_config[:region] = Config[:cloudformation][:region]
51
- end
52
- if aws_config.length != 0 then
53
- @cf = AWS::CloudFormation.new(aws_config)
54
- else
55
- Hiera.debug("No AWS configuration found, will fall back to env variables or IAM role")
56
- @cf = AWS::CloudFormation.new
57
- end
58
- else
59
- Hiera.debug("No configuration found, will fall back to env variables or IAM role")
60
- @cf = AWS::CloudFormation.new
61
- end
62
-
63
- @output_cache = TimedCache.new
64
- @resource_cache = TimedCache.new
65
-
66
- Hiera.debug("Hiera cloudformation backend loaded")
67
- end
68
-
69
- def lookup(key, scope, order_override, resolution_type)
70
- answer = nil
71
-
72
- Backend.datasources(scope, order_override) do |elem|
73
- case elem
74
- when /cfstack\/([^\/]+)\/outputs/
75
- Hiera.debug("Looking up #{key} as an output of stack #{$1}")
76
- raw_answer = stack_output_query($1, key)
77
- when /cfstack\/([^\/]+)\/resources\/([^\/]+)/
78
- Hiera.debug("Looking up #{key} in metadata of stack #{$1} resource #{$2}")
79
- raw_answer = stack_resource_query($1, $2, key)
80
- else
81
- Hiera.debug("#{elem} doesn't seem to be a CloudFormation hierarchy element")
82
- next
83
- end
84
-
85
- next if raw_answer.nil?
86
-
87
- if @parse_metadata then
88
- raw_answer = convert_metadata(raw_answer)
89
- end
90
-
91
- new_answer = Backend.parse_answer(raw_answer, scope)
92
-
93
- case resolution_type
94
- when :array
95
- raise Exception, "Hiera type mismatch: expected Array and got #{new_answer.class}" unless new_answer.kind_of? Array or new_answer.kind_of? String
96
- answer ||= []
97
- answer << new_answer
98
- when :hash
99
- raise Exception, "Hiera type mismatch: expected Hash and got #{new_answer.class}" unless new_answer.kind_of? Hash
100
- answer ||= {}
101
- answer = Backend.merge_answer(new_answer, answer)
102
- else
103
- answer = new_answer
104
- break
105
- end
106
- end
107
-
108
- return answer
109
- end
110
-
111
- def stack_output_query(stack_name, key)
112
- outputs = @output_cache.get(stack_name)
113
-
114
- if outputs.nil? then
115
- Hiera.debug("#{stack_name} outputs not cached, fetching...")
116
- begin
117
- outputs = @cf.stacks[stack_name].outputs
118
- rescue AWS::CloudFormation::Errors::ValidationError
119
- Hiera.debug("Stack #{stack_name} outputs can't be retrieved")
120
- outputs = [] # this is just a non-nil value to serve as marker in cache
121
- end
122
- @output_cache.put(stack_name, outputs, TIMEOUT)
123
- end
124
-
125
- output = outputs.select { |item| item.key == key }
126
-
127
- return output.empty? ? nil : output.shift.value
128
- end
129
-
130
- def stack_resource_query(stack_name, resource_id, key)
131
- metadata = @resource_cache.get({:stack => stack_name, :resource => resource_id})
132
-
133
- if metadata.nil? then
134
- Hiera.debug("#{stack_name} #{resource_id} metadata not cached, fetching")
135
- begin
136
- metadata = @cf.stacks[stack_name].resources[resource_id].metadata
137
- rescue AWS::CloudFormation::Errors::ValidationError
138
- # Stack or resource doesn't exist
139
- Hiera.debug("Stack #{stack_name} resource #{resource_id} can't be retrieved")
140
- metadata = "{}" # This is just a non-nil value to serve as marker in cache
141
- end
142
- @resource_cache.put({:stack => stack_name, :resource => resource_id}, metadata, TIMEOUT)
143
- end
144
-
145
- if metadata.respond_to?(:to_str) then
146
- data = JSON.parse(metadata)
147
-
148
- if data.include?('hiera') then
149
- return data['hiera'][key] if data['hiera'].include?(key)
150
- end
151
- end
152
-
153
- return nil
154
- end
155
-
156
- def convert_metadata(json_object)
157
- if json_object.is_a?(Hash) then
158
- # convert each value of a Hash
159
- converted_object = {}
160
- json_object.each do |key, value|
161
- converted_object[key] = convert_metadata(value)
162
- end
163
- return converted_object
164
- elsif json_object.is_a?(Array) then
165
- # convert each item in an Array
166
- return json_object.map { |item| convert_metadata(item) }
167
- elsif json_object == "true" then
168
- # Boolean literals
169
- return true
170
- elsif json_object == "false" then
171
- return false
172
- elsif json_object == "null" then
173
- return nil
174
- elsif /^-?([1-9]\d*|0)(.\d+)?([eE][+-]?\d+)?$/.match(json_object) then
175
- # Numeric literals
176
- if json_object.include?('.') then
177
- return json_object.to_f
178
- else
179
- return json_object.to_i
180
- end
181
- else
182
- return json_object
183
- end
184
- end
185
- end
186
- end
33
+ if Config[:cloudformation].include?(:redis_port)
34
+ @redis_port = Config[:cloudformation][:redis_port]
35
+ else
36
+ @redis_port = 6379
37
+ end
38
+
39
+ if Config[:cloudformation].include?(:redis_db)
40
+ @redis_db = Config[:cloudformation][:redis_db]
41
+ else
42
+ @redis_db = 0
43
+ end
44
+ end
45
+
46
+ if @redis_host
47
+ @redis = Redis.new(:host => @redis_host, :port => @redis_port, :db => @redis_db)
48
+ else
49
+ @timedcache = TimedCache.new
50
+ end
51
+ end
52
+
53
+ def get(key)
54
+ formatted_key = format_key(key)
55
+
56
+ if @redis
57
+ Hiera.debug("Attempting to fetch #{formatted_key} from Redis")
58
+ result = @redis.get(formatted_key)
59
+ else
60
+ Hiera.debug("Attempting to fetch #{formatted_key} from TimedCache")
61
+ result = @timedcache.get formatted_key
62
+ end
63
+
64
+ JSON.parse(result) unless result.nil?
65
+ end
66
+
67
+ def put(key, value)
68
+ formatted_key = format_key(key)
69
+ formatted_value = format_value(value)
70
+
71
+ if @redis
72
+ if @cache_ttl < 1
73
+ Hiera.debug("Attempting to set #{formatted_key} in Redis")
74
+ @redis.set(formatted_key, formatted_value)
75
+ else
76
+ Hiera.debug("Attempting to setex #{formatted_key} in Redis with TTL of #{@cache_ttl}")
77
+ @redis.setex(formatted_key, @cache_ttl, formatted_value)
78
+ end
79
+ else
80
+ Hiera.debug("Attempting to set #{formatted_key} in TimedCache with TTL of #{@cache_ttl}")
81
+ @timedcache.put(formatted_key, formatted_value, @cache_ttl)
82
+ end
83
+
84
+ formatted_value
85
+ end
86
+
87
+ # If key is Enumerable convert to a json string
88
+ def format_key(key)
89
+ if key.is_a? Enumerable
90
+ key.to_json
91
+ else
92
+ key
93
+ end
94
+ end
95
+
96
+ # Marshal values into sensible JSON form, assumes all arrays contain values of same type
97
+ def format_value(value)
98
+ if value.is_a? Array
99
+ if value.first.is_a? AWS::CloudFormation::StackOutput
100
+ stack_outputs = value.collect do |stack_output|
101
+ {
102
+ :description => stack_output.description,
103
+ :key => stack_output.key,
104
+ :value => stack_output.value
105
+ }
106
+ end
107
+ JSON.generate(stack_outputs)
108
+ else
109
+ JSON.generate(value)
110
+ end
111
+ elsif value.is_a? Hash
112
+ JSON.generate(value)
113
+ else
114
+ value
115
+ end
116
+ end
117
+ end
118
+
119
+ class Cloudformation_backend
120
+ def initialize
121
+ if Config.include?(:cloudformation) && !Config[:cloudformation].nil?
122
+ if Config[:cloudformation].fetch(:parse_metadata, false)
123
+ Hiera.debug('Will convert CloudFormation stringified metadata back to numbers or booleans.')
124
+ @parse_metadata = true
125
+ else
126
+ @parse_metadata = false
127
+ end
128
+
129
+ if Config[:cloudformation].include?(:cache_ttl)
130
+ cache_ttl = Config[:cloudformation][:cache_ttl]
131
+ end
132
+
133
+ aws_config = {}
134
+ if Config[:cloudformation].include?(:access_key_id) && Config[:cloudformation].include?(:secret_access_key)
135
+ Hiera.debug("Found AWS access key #{Config[:cloudformation][:access_key_id]} from configuration")
136
+ aws_config[:access_key_id] = Config[:cloudformation][:access_key_id]
137
+ aws_config[:secret_access_key] = Config[:cloudformation][:secret_access_key]
138
+ end
139
+ if Config[:cloudformation].include?(:region)
140
+ Hiera.debug("Found AWS region #{Config[:cloudformation][:region]} from configuration")
141
+ aws_config[:region] = Config[:cloudformation][:region]
142
+ end
143
+ if aws_config.length != 0
144
+ @cf = AWS::CloudFormation.new(aws_config)
145
+ else
146
+ Hiera.debug('No AWS configuration found, will fall back to env variables or IAM role')
147
+ @cf = AWS::CloudFormation.new
148
+ end
149
+ else
150
+ Hiera.debug('No configuration found, will fall back to env variables or IAM role')
151
+ @cf = AWS::CloudFormation.new
152
+ end
153
+
154
+ cache_ttl ||= 60
155
+ @output_cache = Cache.new(cache_ttl)
156
+ @resource_cache = Cache.new(cache_ttl)
157
+
158
+ Hiera.debug('Hiera cloudformation backend loaded')
159
+ end
160
+
161
+ def lookup(key, scope, order_override, resolution_type)
162
+ answer = nil
163
+
164
+ Backend.datasources(scope, order_override) do |elem|
165
+ case elem
166
+ when %r{cfstack/([^/]+)/outputs}
167
+ Hiera.debug("Looking up #{key} as an output of stack #{$1}")
168
+ raw_answer = stack_output_query($1, key)
169
+ when %r{cfstack/([^/]+)/resources/([^/]+)}
170
+ Hiera.debug("Looking up #{key} in metadata of stack #{$1} resource #{$2}")
171
+ raw_answer = stack_resource_query($1, $2, key)
172
+ else
173
+ Hiera.debug("#{elem} doesn't seem to be a CloudFormation hierarchy element")
174
+ next
175
+ end
176
+
177
+ next if raw_answer.nil?
178
+ raw_answer = convert_metadata(raw_answer) if @parse_metadata
179
+ new_answer = Backend.parse_answer(raw_answer, scope)
180
+
181
+ case resolution_type
182
+ when :array
183
+ fail Exception, "Hiera type mismatch: expected Array and got #{new_answer.class}" unless new_answer.is_a?(Array) || new_answer.is_a?(String)
184
+ answer ||= []
185
+ answer << new_answer
186
+ when :hash
187
+ fail Exception, "Hiera type mismatch: expected Hash and got #{new_answer.class}" unless new_answer.is_a? Hash
188
+ answer ||= {}
189
+ answer = Backend.merge_answer(new_answer, answer)
190
+ else
191
+ answer = new_answer
192
+ break
193
+ end
194
+ end
195
+
196
+ answer
197
+ end
198
+
199
+ def stack_output_query(stack_name, key)
200
+ outputs = @output_cache.get({ :stack => stack_name, :outputs => true })
201
+
202
+ if outputs.nil?
203
+ Hiera.debug("#{stack_name} outputs not cached, fetching...")
204
+ begin
205
+ outputs = @cf.stacks[stack_name].outputs
206
+ rescue AWS::CloudFormation::Errors::ValidationError
207
+ Hiera.debug("Stack #{stack_name} outputs can't be retrieved")
208
+ outputs = [] # this is just a non-nil value to serve as marker in cache
209
+ end
210
+ outputs = @output_cache.put({ :stack => stack_name, :outputs => true }, outputs)
211
+ end
212
+
213
+ output = outputs.select { |item| item[:key] == key }
214
+
215
+ output.empty? ? nil : output.shift.value
216
+ end
217
+
218
+ def stack_resource_query(stack_name, resource_id, key)
219
+ metadata = @resource_cache.get({ :stack => stack_name, :resource => resource_id })
220
+
221
+ if metadata.nil?
222
+ Hiera.debug("#{stack_name} #{resource_id} metadata not cached, fetching")
223
+ begin
224
+ metadata = @cf.stacks[stack_name].resources[resource_id].metadata
225
+ rescue AWS::CloudFormation::Errors::ValidationError
226
+ # Stack or resource doesn't exist
227
+ Hiera.debug("Stack #{stack_name} resource #{resource_id} can't be retrieved")
228
+ metadata = '{}' # This is just a non-nil value to serve as marker in cache
229
+ else
230
+ metadata ||= '{}'
231
+ end
232
+ @resource_cache.put({ :stack => stack_name, :resource => resource_id }, metadata)
233
+ end
234
+
235
+ if metadata.include?('hiera')
236
+ return metadata['hiera'][key] if metadata['hiera'].include?(key)
237
+ end
238
+
239
+ nil
240
+ end
241
+
242
+ def convert_metadata(json_object)
243
+ if json_object.is_a?(Hash)
244
+ # convert each value of a Hash
245
+ converted_object = {}
246
+ json_object.each do |key, value|
247
+ converted_object[key] = convert_metadata(value)
248
+ end
249
+ return converted_object
250
+ elsif json_object.is_a?(Array)
251
+ # convert each item in an Array
252
+ return json_object.map { |item| convert_metadata(item) }
253
+ elsif json_object == 'true'
254
+ # Boolean literals
255
+ return true
256
+ elsif json_object == 'false'
257
+ return false
258
+ elsif json_object == 'null'
259
+ return nil
260
+ elsif /^-?([1-9]\d*|0)(.\d+)?([eE][+-]?\d+)?$/.match(json_object)
261
+ # Numeric literals
262
+ if json_object.include?('.')
263
+ return json_object.to_f
264
+ else
265
+ return json_object.to_i
266
+ end
267
+ else
268
+ return json_object
269
+ end
270
+ end
271
+ end
272
+ end
187
273
  end
@@ -14,38 +14,38 @@ class ConvertMetadataTest < MiniTest::Unit::TestCase
14
14
  end
15
15
 
16
16
  def test_boolean
17
- assert_equal true, @cfb.convert_metadata("true")
18
- assert_equal false, @cfb.convert_metadata("false")
17
+ assert_equal true, @cfb.convert_metadata('true')
18
+ assert_equal false, @cfb.convert_metadata('false')
19
19
  end
20
20
 
21
21
  def test_nil
22
- assert_equal nil, @cfb.convert_metadata("null")
22
+ assert_equal nil, @cfb.convert_metadata('null')
23
23
  end
24
24
 
25
25
  def test_integer
26
- assert_equal 1, @cfb.convert_metadata("1")
27
- assert_equal -1, @cfb.convert_metadata("-1")
26
+ assert_equal 1, @cfb.convert_metadata('1')
27
+ assert_equal -1, @cfb.convert_metadata('-1')
28
28
  end
29
29
 
30
30
  def test_float
31
- assert_in_delta 1.0, @cfb.convert_metadata("1.0"), 0.001
32
- assert_in_delta -1.0, @cfb.convert_metadata("-1.0"), 0.001
31
+ assert_in_delta 1.0, @cfb.convert_metadata('1.0'), 0.001
32
+ assert_in_delta -1.0, @cfb.convert_metadata('-1.0'), 0.001
33
33
  end
34
34
 
35
35
  def test_string
36
- assert_equal "monkey", @cfb.convert_metadata("monkey")
37
- assert_equal "1.0.1", @cfb.convert_metadata("1.0.1")
38
- assert_equal "True", @cfb.convert_metadata("True")
36
+ assert_equal 'monkey', @cfb.convert_metadata('monkey')
37
+ assert_equal '1.0.1', @cfb.convert_metadata('1.0.1')
38
+ assert_equal 'True', @cfb.convert_metadata('True')
39
39
  end
40
40
 
41
41
  def test_array
42
42
  expected = [1, 2, 3, [4, 5, 6]]
43
- assert_equal expected, @cfb.convert_metadata(["1", "2", "3", ["4", "5", "6"]])
43
+ assert_equal expected, @cfb.convert_metadata(['1', '2', '3', ['4', '5', '6']])
44
44
  end
45
45
 
46
46
  def test_hash
47
- expected = {"monkey" => {"fez" => [1, 2, 3]}}
48
- assert_equal expected, @cfb.convert_metadata({"monkey" => {"fez" => ["1", "2", "3"]}})
47
+ expected = { 'monkey' => { 'fez' => [1, 2, 3] } }
48
+ assert_equal expected, @cfb.convert_metadata({ 'monkey' => { 'fez' => ['1', '2', '3'] } })
49
49
  end
50
50
 
51
51
  end
metadata CHANGED
@@ -1,71 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiera-cloudformation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hugh Cole-Baker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-29 00:00:00.000000000 Z
11
+ date: 2015-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: aws-sdk
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.11.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.11.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: timedcache
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.4.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.4.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: json
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: 1.8.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.8.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: redis
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 3.2.1
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 3.2.1
69
83
  description: Queries CloudFormation stack outputs or resource metadata for Hiera data
70
84
  email:
71
85
  - hugh@fanduel.com
@@ -73,11 +87,11 @@ executables: []
73
87
  extensions: []
74
88
  extra_rdoc_files: []
75
89
  files:
90
+ - LICENSE.txt
91
+ - README.md
92
+ - Rakefile
76
93
  - lib/hiera/backend/cloudformation_backend.rb
77
94
  - test/convert_metadata_test.rb
78
- - Rakefile
79
- - README.md
80
- - LICENSE.txt
81
95
  homepage: https://github.com/fanduel/hiera-cloudformation
82
96
  licenses:
83
97
  - Apache License (2.0)
@@ -88,17 +102,17 @@ require_paths:
88
102
  - lib
89
103
  required_ruby_version: !ruby/object:Gem::Requirement
90
104
  requirements:
91
- - - '>='
105
+ - - ">="
92
106
  - !ruby/object:Gem::Version
93
107
  version: '0'
94
108
  required_rubygems_version: !ruby/object:Gem::Requirement
95
109
  requirements:
96
- - - '>='
110
+ - - ">="
97
111
  - !ruby/object:Gem::Version
98
112
  version: '0'
99
113
  requirements: []
100
114
  rubyforge_project:
101
- rubygems_version: 2.0.14
115
+ rubygems_version: 2.4.5
102
116
  signing_key:
103
117
  specification_version: 4
104
118
  summary: CloudFormation backend for Hiera