cfn-model 0.4.15 → 0.4.16
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/cfn_model.rb +5 -1
- data/lib/cfn-model/parser/cfn_parser.rb +17 -0
- 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: 645b4009b868ee8aeef8d4f5f7e1d4958305f952249f1c1450f18f4f537676c1
|
4
|
+
data.tar.gz: 9a7f7e8ed5b94bd9d18ae836e21bcd3444d23e6d6add7a0d630f09a774a91cea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ddca0a63881b9dc1e3baa91ee708fa9ce4a74eaa84239f51c1897042754d3474dcd37ee1dafe6f127967fada9f0c0d8566956e3a0b70464565fcc1a4a540071
|
7
|
+
data.tar.gz: 782787b5d721813e99f03c4a9e04b1d71f4cf68115d5d0f1d094e6506e734cfce2c6b6dc58d1edef521c330d6f66bf9b3c38e98d78302ab324f5a69c1a1a50ea
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require_relative 'references'
|
4
4
|
|
5
5
|
class CfnModel
|
6
|
-
attr_reader :resources, :parameters, :line_numbers, :conditions
|
6
|
+
attr_reader :resources, :parameters, :line_numbers, :conditions, :globals
|
7
7
|
|
8
8
|
##
|
9
9
|
# if you really want it, here it is - the raw Hash from YAML.load. you'll have to mess with structural nits of
|
@@ -15,6 +15,7 @@ class CfnModel
|
|
15
15
|
@parameters = {}
|
16
16
|
@resources = {}
|
17
17
|
@conditions = {}
|
18
|
+
@globals = {}
|
18
19
|
@raw_model = nil
|
19
20
|
@line_numbers = {}
|
20
21
|
end
|
@@ -28,6 +29,9 @@ class CfnModel
|
|
28
29
|
@conditions.each do |k,v|
|
29
30
|
new_cfn_model.conditions[k] = v
|
30
31
|
end
|
32
|
+
@globals.each do |k,v|
|
33
|
+
new_cfn_model.globals[k] = v
|
34
|
+
end
|
31
35
|
@parameters.each do |k,v|
|
32
36
|
new_cfn_model.parameters[k] = v
|
33
37
|
end
|
@@ -83,6 +83,7 @@ class CfnParser
|
|
83
83
|
transform_hash_into_model_elements cfn_hash, cfn_model
|
84
84
|
end
|
85
85
|
transform_hash_into_parameters cfn_hash, cfn_model
|
86
|
+
transform_hash_into_globals cfn_hash, cfn_model
|
86
87
|
|
87
88
|
# pass 2: tie together separate resources only where necessary to make life easier for rule logic
|
88
89
|
post_process_resource_model_elements cfn_model
|
@@ -182,6 +183,22 @@ class CfnParser
|
|
182
183
|
cfn_model
|
183
184
|
end
|
184
185
|
|
186
|
+
def transform_hash_into_globals(cfn_hash, cfn_model)
|
187
|
+
return cfn_model unless cfn_hash.key?('Globals')
|
188
|
+
|
189
|
+
cfn_hash['Globals'].each do |resource, parameter_hash|
|
190
|
+
global = Parameter.new
|
191
|
+
global.id = resource
|
192
|
+
|
193
|
+
parameter_hash.each do |property_name, property_value|
|
194
|
+
global.send("#{map_property_name_to_attribute(property_name)}=", property_value)
|
195
|
+
end
|
196
|
+
|
197
|
+
cfn_model.globals[resource] = global
|
198
|
+
end
|
199
|
+
cfn_model
|
200
|
+
end
|
201
|
+
|
185
202
|
def pre_validate_model(cloudformation_yml)
|
186
203
|
errors = CloudFormationValidator.new.validate cloudformation_yml
|
187
204
|
if !errors.nil? && !errors.empty?
|
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.16
|
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-02-
|
11
|
+
date: 2020-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|