sparkle_formation 3.0.26 → 3.0.28
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 +5 -5
- data/CHANGELOG.md +6 -0
- data/lib/sparkle_formation/composition.rb +17 -17
- data/lib/sparkle_formation/error.rb +2 -5
- data/lib/sparkle_formation/function_struct.rb +27 -31
- data/lib/sparkle_formation/provider/aws.rb +32 -31
- data/lib/sparkle_formation/provider/azure.rb +18 -19
- data/lib/sparkle_formation/provider/google.rb +20 -22
- data/lib/sparkle_formation/provider/heat.rb +17 -17
- data/lib/sparkle_formation/provider/terraform.rb +14 -15
- data/lib/sparkle_formation/provider.rb +0 -2
- data/lib/sparkle_formation/resources/aws.rb +129 -149
- data/lib/sparkle_formation/resources/aws_resources.json +9208 -5542
- data/lib/sparkle_formation/resources/azure.rb +2 -5
- data/lib/sparkle_formation/resources/azure_resources.json +12367 -2901
- data/lib/sparkle_formation/resources/google.rb +1 -4
- data/lib/sparkle_formation/resources/heat.rb +0 -4
- data/lib/sparkle_formation/resources/heat_resources.json +2616 -2062
- data/lib/sparkle_formation/resources/rackspace.rb +0 -4
- data/lib/sparkle_formation/resources/terraform.rb +2 -6
- data/lib/sparkle_formation/resources.rb +20 -24
- data/lib/sparkle_formation/sparkle.rb +56 -66
- data/lib/sparkle_formation/sparkle_attribute/aws.rb +61 -34
- data/lib/sparkle_formation/sparkle_attribute/azure.rb +12 -8
- data/lib/sparkle_formation/sparkle_attribute/google.rb +18 -15
- data/lib/sparkle_formation/sparkle_attribute/heat.rb +22 -7
- data/lib/sparkle_formation/sparkle_attribute/rackspace.rb +0 -2
- data/lib/sparkle_formation/sparkle_attribute/terraform.rb +11 -5
- data/lib/sparkle_formation/sparkle_attribute.rb +13 -7
- data/lib/sparkle_formation/sparkle_collection/rainbow.rb +5 -7
- data/lib/sparkle_formation/sparkle_collection.rb +13 -15
- data/lib/sparkle_formation/sparkle_formation.rb +116 -112
- data/lib/sparkle_formation/sparkle_struct.rb +30 -24
- data/lib/sparkle_formation/translation/heat.rb +57 -58
- data/lib/sparkle_formation/translation/rackspace.rb +48 -49
- data/lib/sparkle_formation/translation.rb +34 -37
- data/lib/sparkle_formation/utils.rb +6 -13
- data/lib/sparkle_formation/version.rb +1 -1
- data/sparkle_formation.gemspec +1 -1
- metadata +9 -9
@@ -16,12 +16,12 @@ class SparkleFormation
|
|
16
16
|
# @param dump_copy [Smash] translated dump
|
17
17
|
# @param parent_names [Array<String>] name of parent resources
|
18
18
|
# @return [Smash] dump_copy
|
19
|
-
def google_template_extractor(template_hash, dump_copy, parent_names=[])
|
19
|
+
def google_template_extractor(template_hash, dump_copy, parent_names = [])
|
20
20
|
template_hash.fetch('resources', []).each do |t_resource|
|
21
|
-
if
|
21
|
+
if t_resource['type'] == stack_resource_type
|
22
22
|
full_names = parent_names + [t_resource['name']]
|
23
23
|
stack = t_resource['properties'].delete('stack')
|
24
|
-
if
|
24
|
+
if t_resource['properties'].empty?
|
25
25
|
t_resource.delete('properties')
|
26
26
|
end
|
27
27
|
google_template_extractor(stack, dump_copy, full_names)
|
@@ -45,18 +45,18 @@ class SparkleFormation
|
|
45
45
|
dump_copy[:imports].push(
|
46
46
|
Smash.new(
|
47
47
|
:name => f_name,
|
48
|
-
:content => r_stack
|
48
|
+
:content => r_stack,
|
49
49
|
)
|
50
50
|
)
|
51
|
-
if
|
51
|
+
if r_parameters
|
52
52
|
dump_copy[:imports].push(
|
53
53
|
Smash.new(
|
54
54
|
:name => "#{f_name}.schema",
|
55
|
-
:content => Smash.new.tap{|schema|
|
55
|
+
:content => Smash.new.tap { |schema|
|
56
56
|
schema.set(:info, :title, "#{f_name} template")
|
57
57
|
schema.set(:info, :description, "#{f_name} template schema")
|
58
58
|
schema.set(:properties, r_parameters)
|
59
|
-
}
|
59
|
+
},
|
60
60
|
)
|
61
61
|
)
|
62
62
|
end
|
@@ -69,13 +69,12 @@ class SparkleFormation
|
|
69
69
|
# @return [Hash]
|
70
70
|
def google_dump
|
71
71
|
result = non_google_dump
|
72
|
-
if
|
72
|
+
if root?
|
73
73
|
dump_copy = Smash.new(:imports => [])
|
74
74
|
google_template_extractor(result, dump_copy)
|
75
75
|
dump_copy.set(:config, :content, result)
|
76
76
|
dump_copy.set(:config, :content, :imports,
|
77
|
-
|
78
|
-
)
|
77
|
+
dump_copy[:imports].map { |i| i[:name] })
|
79
78
|
dump_copy.to_hash
|
80
79
|
else
|
81
80
|
result
|
@@ -125,21 +124,21 @@ class SparkleFormation
|
|
125
124
|
def apply_deep_nesting(*args, &block)
|
126
125
|
outputs = collect_outputs
|
127
126
|
nested_stacks(:with_resource).each do |stack, resource|
|
128
|
-
unless
|
127
|
+
unless stack.nested_stacks.empty?
|
129
128
|
stack.apply_deep_nesting(*args)
|
130
129
|
end
|
131
130
|
stack.compile.parameters.keys!.each do |parameter_name|
|
132
|
-
if
|
131
|
+
if output_name = output_matched?(parameter_name, outputs.keys)
|
133
132
|
next if outputs[output_name] == stack
|
134
133
|
stack_output = stack.make_output_available(output_name, outputs, self)
|
135
134
|
# NOTE: Only set value if not already explicitly set
|
136
|
-
if
|
135
|
+
if resource.properties._set(parameter_name).nil?
|
137
136
|
resource.properties._set(parameter_name, stack_output)
|
138
137
|
end
|
139
138
|
end
|
140
139
|
end
|
141
140
|
end
|
142
|
-
if
|
141
|
+
if block_given?
|
143
142
|
extract_templates(&block)
|
144
143
|
end
|
145
144
|
self
|
@@ -169,20 +168,20 @@ class SparkleFormation
|
|
169
168
|
)
|
170
169
|
)
|
171
170
|
end
|
172
|
-
if
|
173
|
-
if
|
171
|
+
if bubble_path.empty?
|
172
|
+
if drip_path.size == 1
|
174
173
|
parent = drip_path.first.parent
|
175
|
-
if
|
174
|
+
if parent && !parent.compile.parameters._set(output_name).nil?
|
176
175
|
return compile.parameter!(output_name)
|
177
176
|
end
|
178
177
|
end
|
179
178
|
raise ArgumentError.new "Failed to detect available bubbling path for output `#{output_name}`. " <<
|
180
|
-
|
181
|
-
|
182
|
-
|
179
|
+
'This may be due to a circular dependency! ' <<
|
180
|
+
"(Output Path: #{outputs[output_name].root_path.map(&:name).join(' > ')} " <<
|
181
|
+
"Requester Path: #{root_path.map(&:name).join(' > ')})"
|
183
182
|
end
|
184
183
|
result = source_stack.compile._stack_output(bubble_path.first.name, output_name)
|
185
|
-
if
|
184
|
+
if drip_path.size > 1
|
186
185
|
parent = drip_path.first.parent
|
187
186
|
drip_path.unshift(parent) if parent
|
188
187
|
drip_path.each_slice(2) do |base_sparkle, ref_sparkle|
|
@@ -194,7 +193,6 @@ class SparkleFormation
|
|
194
193
|
end
|
195
194
|
result
|
196
195
|
end
|
197
|
-
|
198
196
|
end
|
199
197
|
end
|
200
198
|
end
|
@@ -30,18 +30,18 @@ class SparkleFormation
|
|
30
30
|
def apply_deep_nesting(*args, &block)
|
31
31
|
outputs = collect_outputs
|
32
32
|
nested_stacks(:with_resource).each do |stack, resource|
|
33
|
-
unless
|
33
|
+
unless stack.nested_stacks.empty?
|
34
34
|
stack.apply_deep_nesting(*args)
|
35
35
|
end
|
36
36
|
stack.compile.parameters.keys!.each do |parameter_name|
|
37
|
-
if
|
37
|
+
if output_name = output_matched?(parameter_name, outputs.keys)
|
38
38
|
next if outputs[output_name] == stack
|
39
39
|
stack_output = stack.make_output_available(output_name, outputs)
|
40
40
|
resource.properties.parameters._set(parameter_name, stack_output)
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
44
|
-
if
|
44
|
+
if block_given?
|
45
45
|
extract_templates(&block)
|
46
46
|
end
|
47
47
|
compile
|
@@ -63,7 +63,7 @@ class SparkleFormation
|
|
63
63
|
remap_nested_parameters(compile, parameters, stack_name, stack_resource, output_map)
|
64
64
|
end
|
65
65
|
extract_templates(&block)
|
66
|
-
if
|
66
|
+
if args.include?(:bubble_outputs)
|
67
67
|
output_map.each do |o_name, o_val|
|
68
68
|
compile.outputs._set(o_name).value compile._stack_output(*o_val)
|
69
69
|
end
|
@@ -88,20 +88,20 @@ class SparkleFormation
|
|
88
88
|
)
|
89
89
|
)
|
90
90
|
end
|
91
|
-
if
|
92
|
-
if
|
91
|
+
if bubble_path.empty?
|
92
|
+
if drip_path.size == 1
|
93
93
|
parent = drip_path.first.parent
|
94
|
-
if
|
94
|
+
if parent && !parent.compile.parameters._set(output_name).nil?
|
95
95
|
return compile.parameter!(output_name)
|
96
96
|
end
|
97
97
|
end
|
98
98
|
raise ArgumentError.new "Failed to detect available bubbling path for output `#{output_name}`. " <<
|
99
|
-
|
100
|
-
|
101
|
-
|
99
|
+
'This may be due to a circular dependency! ' <<
|
100
|
+
"(Output Path: #{outputs[output_name].root_path.map(&:name).join(' > ')} " <<
|
101
|
+
"Requester Path: #{root_path.map(&:name).join(' > ')})"
|
102
102
|
end
|
103
103
|
result = compile._stack_output(bubble_path.first.name, output_name)
|
104
|
-
if
|
104
|
+
if drip_path.size > 1
|
105
105
|
parent = drip_path.first.parent
|
106
106
|
drip_path.unshift(parent) if parent
|
107
107
|
drip_path.each_slice(2) do |base_sparkle, ref_sparkle|
|
@@ -131,17 +131,17 @@ class SparkleFormation
|
|
131
131
|
def remap_nested_parameters(template, parameters, stack_name, stack_resource, output_map)
|
132
132
|
nested_template = stack_resource.properties.stack.compile
|
133
133
|
stack_parameters = nested_template.parameters
|
134
|
-
unless
|
134
|
+
unless stack_parameters.nil?
|
135
135
|
stack_parameters._keys.each do |pname|
|
136
136
|
pval = stack_parameters[pname]
|
137
|
-
unless
|
137
|
+
unless pval.stack_unique.nil?
|
138
138
|
check_name = [stack_name, pname].join
|
139
139
|
else
|
140
140
|
check_name = pname
|
141
141
|
end
|
142
|
-
if
|
142
|
+
if !parameters._set(check_name).nil?
|
143
143
|
template.resources._set(stack_name).properties.parameters._set(pname, template._parameter(check_name))
|
144
|
-
elsif
|
144
|
+
elsif output_map[check_name]
|
145
145
|
template.resources._set(stack_name).properties.parameters._set(pname)
|
146
146
|
template._stack_output(*output_map[check_name])
|
147
147
|
else
|
@@ -150,15 +150,15 @@ class SparkleFormation
|
|
150
150
|
end
|
151
151
|
end
|
152
152
|
end
|
153
|
-
unless
|
153
|
+
unless nested_template.outputs.nil?
|
154
154
|
nested_template.outputs.keys!.each do |oname|
|
155
155
|
output_map[oname] = [stack_name, oname]
|
156
156
|
end
|
157
157
|
end
|
158
158
|
true
|
159
159
|
end
|
160
|
-
|
161
160
|
end
|
161
|
+
|
162
162
|
OpenStack = Heat
|
163
163
|
end
|
164
164
|
end
|
@@ -14,13 +14,13 @@ class SparkleFormation
|
|
14
14
|
Smash.new(
|
15
15
|
:parameters => :variable,
|
16
16
|
:resources => :resource,
|
17
|
-
:outputs => :output
|
17
|
+
:outputs => :output,
|
18
18
|
).each do |original, updated|
|
19
|
-
if
|
19
|
+
if val = result.delete(original)
|
20
20
|
result[updated] = val
|
21
21
|
end
|
22
22
|
end
|
23
|
-
if
|
23
|
+
if resources = result.delete(:resource)
|
24
24
|
result[:resource] = Smash.new
|
25
25
|
resources.each do |r_name, r_info|
|
26
26
|
result.set(:resource, r_info[:type], r_name, r_info[:properties])
|
@@ -72,21 +72,21 @@ class SparkleFormation
|
|
72
72
|
def apply_deep_nesting(*args, &block)
|
73
73
|
outputs = collect_outputs
|
74
74
|
nested_stacks(:with_resource).each do |stack, resource|
|
75
|
-
unless
|
75
|
+
unless stack.nested_stacks.empty?
|
76
76
|
stack.apply_deep_nesting(*args)
|
77
77
|
end
|
78
78
|
stack.compile.parameters.keys!.each do |parameter_name|
|
79
|
-
if
|
79
|
+
if output_name = output_matched?(parameter_name, outputs.keys)
|
80
80
|
next if outputs[output_name] == stack
|
81
81
|
stack_output = stack.make_output_available(output_name, outputs, self)
|
82
82
|
# NOTE: Only set value if not already explicitly set
|
83
|
-
if
|
83
|
+
if resource.properties.parameters._set(parameter_name).nil?
|
84
84
|
resource.properties.parameters._set(parameter_name, stack_output)
|
85
85
|
end
|
86
86
|
end
|
87
87
|
end
|
88
88
|
end
|
89
|
-
if
|
89
|
+
if block_given?
|
90
90
|
extract_templates(&block)
|
91
91
|
end
|
92
92
|
self
|
@@ -115,20 +115,20 @@ class SparkleFormation
|
|
115
115
|
)
|
116
116
|
)
|
117
117
|
end
|
118
|
-
if
|
119
|
-
if
|
118
|
+
if bubble_path.empty?
|
119
|
+
if drip_path.size == 1
|
120
120
|
parent = drip_path.first.parent
|
121
|
-
if
|
121
|
+
if parent && !parent.compile.parameters._set(output_name).nil?
|
122
122
|
return compile.parameter!(output_name)
|
123
123
|
end
|
124
124
|
end
|
125
125
|
raise ArgumentError.new "Failed to detect available bubbling path for output `#{output_name}`. " <<
|
126
|
-
|
127
|
-
|
128
|
-
|
126
|
+
'This may be due to a circular dependency! ' <<
|
127
|
+
"(Output Path: #{outputs[output_name].root_path.map(&:name).join(' > ')} " <<
|
128
|
+
"Requester Path: #{root_path.map(&:name).join(' > ')})"
|
129
129
|
end
|
130
130
|
result = source_stack.compile._stack_output(bubble_path.first.name, output_name)
|
131
|
-
if
|
131
|
+
if drip_path.size > 1
|
132
132
|
parent = drip_path.first.parent
|
133
133
|
drip_path.unshift(parent) if parent
|
134
134
|
drip_path.each_slice(2) do |base_sparkle, ref_sparkle|
|
@@ -140,7 +140,6 @@ class SparkleFormation
|
|
140
140
|
end
|
141
141
|
result
|
142
142
|
end
|
143
|
-
|
144
143
|
end
|
145
144
|
end
|
146
145
|
end
|
@@ -3,13 +3,11 @@ require 'sparkle_formation'
|
|
3
3
|
class SparkleFormation
|
4
4
|
# Provider specific implementation namespace
|
5
5
|
module Provider
|
6
|
-
|
7
6
|
autoload :Aws, 'sparkle_formation/provider/aws'
|
8
7
|
autoload :Azure, 'sparkle_formation/provider/azure'
|
9
8
|
autoload :Google, 'sparkle_formation/provider/google'
|
10
9
|
autoload :Heat, 'sparkle_formation/provider/heat'
|
11
10
|
autoload :OpenStack, 'sparkle_formation/provider/heat'
|
12
11
|
autoload :Terraform, 'sparkle_formation/provider/terraform'
|
13
|
-
|
14
12
|
end
|
15
13
|
end
|