cloudformation-tool 1.5.15 → 1.5.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32f485059a283b0a34a74ac687c52fe01b6d9522616cc00beb572b46e9a13e1d
4
- data.tar.gz: 9533caf5496a471432cadfbf007dd20a6789829d353642538052bde818ed6bfe
3
+ metadata.gz: cda5830569bb0452c460ca5751f58071594e3a8752662676364a8c7360035dff
4
+ data.tar.gz: 1677f34f4acdc68bf0e7b7870e39f56d8efa351e2d734364ca69ff5c9c74780c
5
5
  SHA512:
6
- metadata.gz: cdd70a1186411fa08ddca90d687c53ad4d5113d503fd02068e6b84e63a3080a11d4dfc9e58f6a8231a90d05ef4ddb5212ece90cae208562a4caef2d54d1eb42c
7
- data.tar.gz: f1d758e208b657d5f8e829e4e1dd079850ec4eaa8c1a9593ed09036da9cfe91fc5447edb305d6ed68005a3eda5f2e43df37c7ed4678b03ec8cac745e321af5eb
6
+ metadata.gz: bd0fc20ae3e89881114581d638b304b137fc9064d362cf6746143df6931db2a91e95898a20ece7061c07ca78d963f279186c1f17012bcef7672612e1b14700bb
7
+ data.tar.gz: f22e1e4ffb42bfbfb043625c291ab997b0e8fae5adbffa327160dd4400390837b65e57d57859f6b7c0b849ae3c3a5b9f1873bf99343ae4b90bb66b13d6c6adcd
@@ -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: "cf-compiled/#{md5[0]}/#{md5[1..2]}/#{md5}/").first
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("cf-compiled/#{prefix}/#{path}")
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)
@@ -1,3 +1,3 @@
1
1
  module CloudFormationTool
2
- VERSION = '1.5.15'
2
+ VERSION = '1.5.17'
3
3
  end
@@ -15,7 +15,7 @@ def log(message = nil, &block)
15
15
  end)
16
16
  end
17
17
 
18
- def debug(message = nul, &block)
18
+ def debug(message = nil, &block)
19
19
  logger.debug(if message.nil?
20
20
  yield
21
21
  else
@@ -23,7 +23,7 @@ def debug(message = nul, &block)
23
23
  end)
24
24
  end
25
25
 
26
- def warn(message = nul, &block)
26
+ def warn(message = nil, &block)
27
27
  logger.warn(if message.nil?
28
28
  yield
29
29
  else
@@ -31,7 +31,7 @@ def warn(message = nul, &block)
31
31
  end)
32
32
  end
33
33
 
34
- def error(message = nul, &block)
34
+ def error(message = nil, &block)
35
35
  logger.error(if message.nil?
36
36
  yield
37
37
  else
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.15
4
+ version: 1.5.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oded Arbel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-11 00:00:00.000000000 Z
11
+ date: 2024-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -222,7 +222,7 @@ 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.15
225
+ rubygems_version: 3.4.20
226
226
  signing_key:
227
227
  specification_version: 4
228
228
  summary: A pre-compiler tool for CloudFormation YAML templates