cloudformation-tool 1.5.14 → 1.5.16
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3e8d4a5cbf8e7c4507df05dc594406e66b3cb4ee6b0879dbec0b5773a0b560da
|
|
4
|
+
data.tar.gz: 4ecf077524e906ccf844b83afe9e19d98ba1a41d223987c0cc3fdb3a96fea3ac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1a10a4d380dbab3d0e3c152fae9877d66872fa1cda68c493826342a59a629b4bc325dfd6abc6cd24e0c64b5064d10d60edba683152e6c0517c5587a6fe1e8010
|
|
7
|
+
data.tar.gz: ea96dc4874e8a2e8564927ec5c335a3077c2e3ea9417f170aa8f20f17f91b6c2e0bbee69091783a7a6b81a13a76be1e467d6718a247f33f6ff12926ac3c6479a
|
|
@@ -102,50 +102,36 @@ module CloudFormationTool
|
|
|
102
102
|
# some categories are meta-data that we can ignore from includes
|
|
103
103
|
next if %w(AWSTemplateFormatVersion Description).include? category
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
105
|
+
if category == "Parameters"
|
|
106
|
+
rewriteParameters catdata, cfile_key, rewrites
|
|
107
|
+
@data["Parameters"].merge! catdata
|
|
108
|
+
next
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
case catdata
|
|
112
|
+
when Hash
|
|
113
|
+
# warn against duplicate entities, resources or outputs
|
|
114
|
+
(@data[category] ||= {}).keys.each do |key|
|
|
115
|
+
if catdata.has_key? key
|
|
116
|
+
raise CloudFormationTool::Errors::AppError, "Error compiling #{path} - duplicate '#{category}' item: #{key}"
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
catdata = fixrefs(catdata, rewrites)
|
|
120
|
+
# add included properties
|
|
121
|
+
@data[category].merge! catdata
|
|
122
|
+
when Array
|
|
123
|
+
if @data[category].nil?
|
|
124
|
+
@data[category] = catdata
|
|
125
|
+
elsif @data[category].is_a? Array
|
|
126
|
+
@data[category] += catdata
|
|
127
|
+
else
|
|
128
|
+
raise CloudFormationTool::Errors::AppError, "Error compiling #{path} - conflicting types for '#{category}'"
|
|
122
129
|
end
|
|
123
130
|
else
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
# warn against duplicate entities, resources or outputs
|
|
127
|
-
(@data[category] ||= {}).keys.each do |key|
|
|
128
|
-
if catdata.has_key? key
|
|
129
|
-
raise CloudFormationTool::Errors::AppError, "Error compiling #{path} - duplicate '#{category}' item: #{key}"
|
|
130
|
-
end
|
|
131
|
-
end
|
|
132
|
-
catdata = fixrefs(catdata, rewrites)
|
|
133
|
-
# add included properties
|
|
134
|
-
@data[category].merge! catdata
|
|
135
|
-
when Array
|
|
136
|
-
if @data[category].nil?
|
|
137
|
-
@data[category] = catdata
|
|
138
|
-
elsif @data[category].is_a? Array
|
|
139
|
-
@data[category] += catdata
|
|
140
|
-
else
|
|
141
|
-
raise CloudFormationTool::Errors::AppError, "Error compiling #{path} - conflicting types for '#{category}'"
|
|
142
|
-
end
|
|
131
|
+
if @data[category].nil?
|
|
132
|
+
@data[category] = catdata
|
|
143
133
|
else
|
|
144
|
-
|
|
145
|
-
@data[category] = catdata
|
|
146
|
-
else
|
|
147
|
-
raise CloudFormationTool::Errors::AppError, "Error compiling #{path} - I do not know how to merge non-list non-dictionary '#{category}'!"
|
|
148
|
-
end
|
|
134
|
+
raise CloudFormationTool::Errors::AppError, "Error compiling #{path} - I do not know how to merge non-list non-dictionary '#{category}'!"
|
|
149
135
|
end
|
|
150
136
|
end
|
|
151
137
|
|
|
@@ -153,6 +139,27 @@ module CloudFormationTool
|
|
|
153
139
|
end
|
|
154
140
|
end
|
|
155
141
|
|
|
142
|
+
def rewriteParameters data, key, rewrites
|
|
143
|
+
(@data["Parameters"]||={}).each do |name, param|
|
|
144
|
+
unless data.has_key? name
|
|
145
|
+
@data["Parameters"][name] = param
|
|
146
|
+
next
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
next if param['Default'] == data[name]['Default']
|
|
150
|
+
|
|
151
|
+
if data[name].has_key?('Override') and data[name]['Override'] == false
|
|
152
|
+
data.delete(name)
|
|
153
|
+
next
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
newname = "#{key}z#{name}"
|
|
157
|
+
log "Rewriting conflicting parameter #{name} (='#{data[name]['Default']}') to #{newname}"
|
|
158
|
+
data[newname] = data.delete name
|
|
159
|
+
rewrites[name] = newname
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
156
163
|
def resolveVal(value)
|
|
157
164
|
case value
|
|
158
165
|
when Hash
|
|
@@ -15,12 +15,15 @@ module CloudFormationTool
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def cached_object(md5)
|
|
18
|
-
Aws::S3::Bucket.new(s3_bucket_name(region), client: awss3(region)).objects(prefix:
|
|
18
|
+
Aws::S3::Bucket.new(s3_bucket_name(region), client: awss3(region)).objects(prefix: prefix(md5)).first
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def prefix(md5)
|
|
22
|
+
"cf-compiled/#{md5[0]}/#{md5[1..2]}/#{md5}/"
|
|
19
23
|
end
|
|
20
24
|
|
|
21
25
|
def upload(path, content, mime_type: 'text/yaml', gzip: true)
|
|
22
26
|
md5 = Digest::MD5.hexdigest content
|
|
23
|
-
prefix = "#{md5[0]}/#{md5[1..2]}/#{md5}"
|
|
24
27
|
b = Aws::S3::Bucket.new(s3_bucket_name(region), client: awss3(region))
|
|
25
28
|
# return early if we already have a copy of this object stored.
|
|
26
29
|
# if this object was previously uploaded, we use its URLs (and not, for example,
|
|
@@ -30,7 +33,7 @@ module CloudFormationTool
|
|
|
30
33
|
o = cached_object(md5)
|
|
31
34
|
if o.nil?
|
|
32
35
|
# no such luck, we need to actually upload the file
|
|
33
|
-
o = b.object(
|
|
36
|
+
o = b.object(prefix(md5) + path)
|
|
34
37
|
file_opts = {
|
|
35
38
|
acl: 'public-read',
|
|
36
39
|
body: content,
|
|
@@ -38,6 +41,11 @@ module CloudFormationTool
|
|
|
38
41
|
content_type: mime_type,
|
|
39
42
|
storage_class: 'REDUCED_REDUNDANCY'
|
|
40
43
|
}
|
|
44
|
+
ownctl = b.client.get_bucket_ownership_controls(bucket: b.name).ownership_controls
|
|
45
|
+
if ownctl.rules.first.object_ownership == 'BucketOwnerEnforced' then
|
|
46
|
+
# no point in setting ACL
|
|
47
|
+
file_opts.delete :acl
|
|
48
|
+
end
|
|
41
49
|
file_opts.merge!({content_encoding: 'gzip'}) if gzip
|
|
42
50
|
debug "Uploading S3 object s3://#{b.name}/#{o.key}"
|
|
43
51
|
o.put(file_opts)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cloudformation-tool
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.5.
|
|
4
|
+
version: 1.5.16
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Oded Arbel
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2024-06-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|
|
@@ -164,7 +164,7 @@ dependencies:
|
|
|
164
164
|
- - ">="
|
|
165
165
|
- !ruby/object:Gem::Version
|
|
166
166
|
version: '0'
|
|
167
|
-
description:
|
|
167
|
+
description:
|
|
168
168
|
email: oded.arbel@greenfieldtech.net
|
|
169
169
|
executables:
|
|
170
170
|
- cftool
|
|
@@ -207,7 +207,7 @@ homepage: http://github.com/GreenfieldTech/cloudformation-tool
|
|
|
207
207
|
licenses:
|
|
208
208
|
- GPL-2.0
|
|
209
209
|
metadata: {}
|
|
210
|
-
post_install_message:
|
|
210
|
+
post_install_message:
|
|
211
211
|
rdoc_options: []
|
|
212
212
|
require_paths:
|
|
213
213
|
- lib
|
|
@@ -222,8 +222,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
222
222
|
- !ruby/object:Gem::Version
|
|
223
223
|
version: '0'
|
|
224
224
|
requirements: []
|
|
225
|
-
rubygems_version: 3.3.
|
|
226
|
-
signing_key:
|
|
225
|
+
rubygems_version: 3.3.5
|
|
226
|
+
signing_key:
|
|
227
227
|
specification_version: 4
|
|
228
228
|
summary: A pre-compiler tool for CloudFormation YAML templates
|
|
229
229
|
test_files: []
|