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 +4 -4
- data/lib/cfn-model/model/references.rb +17 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cfb10903ae3fbf18dc0c8d07db826851348197984e10834dde228a4f40d453d
|
4
|
+
data.tar.gz: 9c2e9362dd9e75eb6ee7b90566468b579d5d725fbd23e1791f1af46926af4f8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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-
|
11
|
+
date: 2020-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|