aws-cfn-compiler 0.9.19 → 0.9.20
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 +4 -4
- data/aws-cfn-compiler.iml +0 -35
- data/lib/aws/cfn/compiler/base.rb +26 -13
- data/lib/aws/cfn/compiler/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 640e002a656701661bb83c206787586544be8146
|
4
|
+
data.tar.gz: 5365902f02751c7043df5b3566d2f3332a8781a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24cf23031d4cf11fc27c85ab89a36bce568743e824ba02a1b04186596b8222acd789351d8bd9f67bebde4ffaacf32d23c45cf4c27a60103437e0773f7d4328ea
|
7
|
+
data.tar.gz: 36c7d203fabf3d67642ad8229d119e9e96e92993524f5d6c380658e41ccf66b5929fdc0c97f33eccd013568062b8bc2877e62318e82cefdb4956219429d19c44
|
data/aws-cfn-compiler.iml
CHANGED
@@ -10,40 +10,6 @@
|
|
10
10
|
<orderEntry type="sourceFolder" forTests="false" />
|
11
11
|
<orderEntry type="module" module-name="aws-cfn-dsl" />
|
12
12
|
<orderEntry type="module" module-name="cloudformation-ruby-dsl" />
|
13
|
-
<orderEntry type="module-library">
|
14
|
-
<library name="aws-cfn-dsl (v0.9.6, /Users/cdelange/Dropbox/DLDInternet/ws/gems-ws/aws-cfn-dsl) [path][gem]">
|
15
|
-
<CLASSES>
|
16
|
-
<root url="file://$MODULE_DIR$/../aws-cfn-dsl/bin" />
|
17
|
-
<root url="file://$MODULE_DIR$/../aws-cfn-dsl/lib" />
|
18
|
-
<root url="file://$MODULE_DIR$/../aws-cfn-dsl/pkg" />
|
19
|
-
<root url="file://$MODULE_DIR$/../aws-cfn-dsl/.idea" />
|
20
|
-
</CLASSES>
|
21
|
-
<JAVADOC />
|
22
|
-
<SOURCES>
|
23
|
-
<root url="file://$MODULE_DIR$/../aws-cfn-dsl/bin" />
|
24
|
-
<root url="file://$MODULE_DIR$/../aws-cfn-dsl/lib" />
|
25
|
-
<root url="file://$MODULE_DIR$/../aws-cfn-dsl/pkg" />
|
26
|
-
<root url="file://$MODULE_DIR$/../aws-cfn-dsl/.idea" />
|
27
|
-
</SOURCES>
|
28
|
-
</library>
|
29
|
-
</orderEntry>
|
30
|
-
<orderEntry type="module-library">
|
31
|
-
<library name="cloudformation-ruby-dsl (v[path], /Users/cdelange/Dropbox/DLDInternet/ws/gems-ws/cloudformation-ruby-dsl) [path][gem]">
|
32
|
-
<CLASSES>
|
33
|
-
<root url="file://$MODULE_DIR$/../cloudformation-ruby-dsl/bin" />
|
34
|
-
<root url="file://$MODULE_DIR$/../cloudformation-ruby-dsl/lib" />
|
35
|
-
<root url="file://$MODULE_DIR$/../cloudformation-ruby-dsl/.idea" />
|
36
|
-
<root url="file://$MODULE_DIR$/../cloudformation-ruby-dsl/vendor" />
|
37
|
-
</CLASSES>
|
38
|
-
<JAVADOC />
|
39
|
-
<SOURCES>
|
40
|
-
<root url="file://$MODULE_DIR$/../cloudformation-ruby-dsl/bin" />
|
41
|
-
<root url="file://$MODULE_DIR$/../cloudformation-ruby-dsl/lib" />
|
42
|
-
<root url="file://$MODULE_DIR$/../cloudformation-ruby-dsl/.idea" />
|
43
|
-
<root url="file://$MODULE_DIR$/../cloudformation-ruby-dsl/vendor" />
|
44
|
-
</SOURCES>
|
45
|
-
</library>
|
46
|
-
</orderEntry>
|
47
13
|
<orderEntry type="module-library">
|
48
14
|
<library name="dldinternet-mixlib-cli (v0.2.0, /Users/cdelange/Dropbox/DLDInternet/ws/gems-ws/dldinternet-mixlib-cli) [path][gem]">
|
49
15
|
<CLASSES>
|
@@ -79,7 +45,6 @@
|
|
79
45
|
</library>
|
80
46
|
</orderEntry>
|
81
47
|
<orderEntry type="library" scope="PROVIDED" name="awesome_print (v1.2.0, RVM: ruby-1.9.3-p547 [aws-cfn-compile]) [gem]" level="application" />
|
82
|
-
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.6.2, RVM: ruby-1.9.3-p547 [aws-cfn-compile]) [gem]" level="application" />
|
83
48
|
<orderEntry type="library" scope="PROVIDED" name="detabulator (v0.1.0, RVM: ruby-1.9.3-p547 [aws-cfn-compile]) [gem]" level="application" />
|
84
49
|
<orderEntry type="library" scope="PROVIDED" name="inifile (v2.0.2, RVM: ruby-1.9.3-p547 [aws-cfn-compile]) [gem]" level="application" />
|
85
50
|
<orderEntry type="library" scope="PROVIDED" name="json (v1.8.1, RVM: ruby-1.9.3-p547 [aws-cfn-compile]) [gem]" level="application" />
|
@@ -18,16 +18,29 @@ module Aws
|
|
18
18
|
super
|
19
19
|
@items = {}
|
20
20
|
@dynamic_items = {}
|
21
|
+
@dynamic_references = {}
|
22
|
+
@all_sections.each do |section|
|
23
|
+
@dynamic_items[section] ||= {}
|
24
|
+
@dynamic_references[section] ||= []
|
25
|
+
end
|
21
26
|
end
|
22
27
|
|
23
28
|
def dynamic_item(section,resource,hash)
|
24
29
|
abort! "Invalid section '#{section}'\nValid sections are: #{@all_sections.join(',')}" unless @all_sections.include?(section)
|
25
|
-
unless @dynamic_items.has_key?(section)
|
26
|
-
@dynamic_items[section] ||= {}
|
27
|
-
end
|
28
30
|
@dynamic_items[section][resource] = hash
|
29
31
|
end
|
30
32
|
|
33
|
+
def dynamic_reference(section,resource)
|
34
|
+
abort! "Invalid section '#{section}'\nValid sections are: #{@all_sections.join(',')}" unless @all_sections.include?(section)
|
35
|
+
@dynamic_references[section] << resource
|
36
|
+
end
|
37
|
+
|
38
|
+
def _uniq_names(arr)
|
39
|
+
names = {}
|
40
|
+
arr.map { |n| names[n] = nil }
|
41
|
+
names.keys
|
42
|
+
end
|
43
|
+
|
31
44
|
def validate(compiled)
|
32
45
|
abort! 'No Resources!?' unless compiled['Resources']
|
33
46
|
logStep 'Validating template'
|
@@ -68,11 +81,11 @@ module Aws
|
|
68
81
|
# --- Mappings ----------------------------------------------------------------------------------------------
|
69
82
|
mappings = find_maps(compiled)
|
70
83
|
mpgs = compiled['Mappings'].nil? ? [] : compiled['Mappings'].keys
|
71
|
-
names = mpgs
|
84
|
+
names = _uniq_names(mpgs+@dynamic_items['Mappings'].keys)
|
72
85
|
|
73
86
|
maps = {}
|
74
87
|
mappings.each{|m| maps[m[:mapping]] = m[:source] }
|
75
|
-
mapnames = maps.keys
|
88
|
+
mapnames = maps.keys+@dynamic_references['Mappings']
|
76
89
|
net = (mapnames-names)
|
77
90
|
unless net.empty?
|
78
91
|
@logger.error '!!! Unknown mappings !!!'
|
@@ -91,9 +104,9 @@ module Aws
|
|
91
104
|
@logger.info ' Mappings validated'
|
92
105
|
|
93
106
|
# --- Conditions ----------------------------------------------------------------------------------------------
|
94
|
-
cond = find_conditions(compiled)
|
107
|
+
cond = find_conditions(compiled)+@dynamic_references['Conditions']
|
95
108
|
cnds = compiled['Conditions'].keys rescue []
|
96
|
-
names = cnds
|
109
|
+
names = _uniq_names(cnds+@dynamic_items['Conditions'].keys)
|
97
110
|
|
98
111
|
net = (cond-names)
|
99
112
|
unless net.empty?
|
@@ -116,9 +129,9 @@ module Aws
|
|
116
129
|
# Parameters => Resources => Outputs
|
117
130
|
refs = find_refs(compiled).select { |a,_| !(a =~ /^AWS::/) }
|
118
131
|
rscs = compiled['Resources'].keys
|
119
|
-
names = rscs+prms+cnds
|
132
|
+
names = _uniq_names((mpgs+rscs+prms+cnds)+@dynamic_items['Mappings'].keys+@dynamic_items['Conditions'].keys+@dynamic_items['Parameters'].keys+@dynamic_items['Resources'].keys)
|
120
133
|
|
121
|
-
net = (refs.keys-names)
|
134
|
+
net = (_uniq_names(refs.keys+@dynamic_references['Mappings']+@dynamic_references['Parameters']+@dynamic_references['Resources'])-names)
|
122
135
|
unless net.empty?
|
123
136
|
@logger.error '!!! Unknown references !!!'
|
124
137
|
net.each do |name|
|
@@ -126,17 +139,17 @@ module Aws
|
|
126
139
|
end
|
127
140
|
abort!
|
128
141
|
end
|
129
|
-
net = (prms-refs.keys)
|
142
|
+
net = (prms+@dynamic_items['Parameters'].keys-refs.keys-@dynamic_references['Parameters'])
|
130
143
|
unless net.empty?
|
131
144
|
@logger.warn '!!! Unused Parameters !!!'
|
132
|
-
net.each do |name|
|
145
|
+
net.sort.each do |name|
|
133
146
|
@logger.warn " #{name}"
|
134
147
|
end
|
135
148
|
end
|
136
|
-
net = (rscs.
|
149
|
+
net = (rscs+@dynamic_items['Resources'].keys-refs.keys-@dynamic_references['Resources'])
|
137
150
|
unless net.empty?
|
138
151
|
@logger.info '!!! Unreferenced Resources !!!'
|
139
|
-
net.each do |name|
|
152
|
+
net.sort.each do |name|
|
140
153
|
@logger.info " #{name}"
|
141
154
|
end
|
142
155
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-cfn-compiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PKinney
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|