cloudformation-tool 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d20f67bcc37c49351026eb98cef017457edc1f32
4
- data.tar.gz: 38ff68d4a7bb51911051098d13540b5549093629
3
+ metadata.gz: e7b9610569b0d65c7af93fc51430e33d2020f8cc
4
+ data.tar.gz: 9d0199f6d1ed1193418eb7a912c313abadd10e5e
5
5
  SHA512:
6
- metadata.gz: 1ecb42453c9cd9152c221aa204d76d1286b57daae0fb969a5bda8cab794a32e34e1c1855f78c9b3f24b82d918ca0bc95dcb00cf179b10281b4a8780f500f3134
7
- data.tar.gz: 5e35126a9b55dd57ad87378934cface4dcb24fc6877d8ff9f2bea8e8aa9962e7ea8f6e621259bc64a2002d4bd7e3685cb0d24896c4401c53a8e780bd113bf5fe
6
+ metadata.gz: d1e0e9be5c9ece04814e98fb42831508cc1310adbae7c615e2b4fba6b604b0fdf0b5132a094a0f8bd8a327c9c8af53666fd6d67cdc189589ac156923b7756169
7
+ data.tar.gz: c9aced3e58604de4d2c33285ccb9ffcb99eba55ec1b77f0320770550ea99b78035303279777c1d9a56782a33c53ee253a3dddc464ecb31ff843ed491d0b3369f
@@ -17,7 +17,7 @@ module CloudFormationTool
17
17
  @path = "#{@path}.yaml" if !File.exist? @path and File.exist? "#{@path}.yaml"
18
18
  @basedir = File.dirname(@path)
19
19
  @compiled = false
20
- @params = {}
20
+ @params = nil
21
21
  text = File.read(@path)
22
22
  # remove comments because white space seen between comments can seriously psych Psych
23
23
  text.gsub!(/^#.*\n/s,'')
@@ -128,10 +128,17 @@ module CloudFormationTool
128
128
  case value
129
129
  when Hash
130
130
  if value['Ref']
131
- @params[value['Ref']] || # parameters are set for this template - we can resolve
132
- # no parameters, we are probably in a sub template, just return the ref and hope a parent template
133
- # has what it takes to resolve the ref
131
+ if @params.nil?
132
+ # no parameters, we are probably in a sub template, just return the ref and hope
133
+ # a parent template has what it takes to resolve the ref
134
134
  value
135
+ else # parameters are set for this template - we can try to resolve
136
+ res = @params[value['Ref']] || (@data['Parameters']||{})[value['Ref']]
137
+ if res.nil?
138
+ raise CloudFormationTool::Errors::AppError, "Reference #{value['Ref']} can't be resolved"
139
+ end
140
+ res
141
+ end
135
142
  else
136
143
  raise CloudFormationTool::Errors::AppError, "Value #{value} is not a valid value or reference"
137
144
  end
@@ -154,7 +161,13 @@ module CloudFormationTool
154
161
  { "Fn::Base64" => { "Fn::Sub" => CloudInit.new("#{@basedir}/#{val["File"]}").compile } }
155
162
  elsif (key == "Code") and (val["URL"])
156
163
  # Support Lambda Code from arbitrary URLs
157
- LambdaCode.new(resolveVal(val["URL"])).to_cloudformation
164
+ url = resolveVal(val["URL"])
165
+ if url.is_a? String # resolving works
166
+ LambdaCode.new(url).to_cloudformation
167
+ else # resolving didn't work - we probably don't have parameters
168
+ # push it upstream and hope a parent template can resolve it
169
+ val
170
+ end
158
171
  else
159
172
  load_files(val)
160
173
  end
@@ -1,3 +1,3 @@
1
1
  module CloudFormationTool
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudformation-tool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oded Arbel