cfn-model 0.4.29 → 0.4.30

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
  SHA256:
3
- metadata.gz: 5c60ef54532b89cab5abaf2c3bf9381a7e9e0529f1ee9d1a516941e4ec9e9393
4
- data.tar.gz: e77b5257bf99294ddc85ec54763e475be9a5b9ad4e4895e88cb552a7ea302a99
3
+ metadata.gz: 4cfb10903ae3fbf18dc0c8d07db826851348197984e10834dde228a4f40d453d
4
+ data.tar.gz: 9c2e9362dd9e75eb6ee7b90566468b579d5d725fbd23e1791f1af46926af4f8a
5
5
  SHA512:
6
- metadata.gz: 1713962ad868efd3d92c97e5eff4a9e6300113afa35cf94f7ac5cd00cc7824c98ba8a9206616cd130a0e939d00e9ec44cbb422af2a0449674712c606b17383be
7
- data.tar.gz: e9ba5783d5b37bec3edf86ec7f194c6bbf60bbcb310a87d14ce6e0b03b2b135f8abd565666b8a5ca8403659ca46b17cfb154643d71910ce7e8b04be8bc510e58
6
+ metadata.gz: 6e5d026023c580e5ace9123da3ecf62cfd265b424c584c83156e5ee595c3ed863a2d783d971bc8f4b3fb3629007aa795156257ad75ea6a1a6084723ec64005b3
7
+ data.tar.gz: 7798edc1e68b7073e3e880e4f66687c3f8e80bb3a5740f397a6af060d8d9fafa1b9912ad5393e71da26d0b65ff0d2b38da7418bf27e73474b33e33b0cf87c38b
@@ -10,15 +10,20 @@ require 'cfn-model/parser/parser_error'
10
10
  # clear
11
11
  module References
12
12
  def self.resolve_value(cfn_model, value)
13
-
14
13
  if value.is_a? Hash
15
14
  if value.has_key?('Ref')
16
15
  resolve_reference(cfn_model, value)
17
16
  elsif value.has_key?('Fn::FindInMap')
18
17
  resolve_map(cfn_model, value)
18
+ elsif value.has_key?('Fn::If')
19
+ resolve_if(cfn_model, value)
19
20
  else
20
- value
21
+ value.map do |k,v|
22
+ [k, resolve_value(cfn_model, v)]
23
+ end.to_h
21
24
  end
25
+ elsif value.is_a? Array
26
+ value.map { |item| resolve_value(cfn_model, item) }
22
27
  else
23
28
  value
24
29
  end
@@ -96,6 +101,16 @@ module References
96
101
 
97
102
  private
98
103
 
104
+ def self.resolve_if(cfn_model, expression)
105
+ if_expression = expression['Fn::If']
106
+ condition_name = if_expression[0]
107
+ if cfn_model.conditions[condition_name]
108
+ resolve_value(cfn_model, if_expression[1])
109
+ else
110
+ resolve_value(cfn_model, if_expression[2])
111
+ end
112
+ end
113
+
99
114
  def self.logical_resource_id_from_get_att(attribute_spec, attr_to_retrieve=nil)
100
115
  if attribute_spec.is_a? Array
101
116
  if !attr_to_retrieve || attribute_spec[1] == attr_to_retrieve
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfn-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.29
4
+ version: 0.4.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Kascic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-01 00:00:00.000000000 Z
11
+ date: 2020-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop