cloudformation-tool 0.5.3 → 0.5.4
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/lib/cloud_formation_tool/cloud_formation/lambda_code.rb +1 -1
- data/lib/cloud_formation_tool/cloud_formation/stack.rb +1 -1
- data/lib/cloud_formation_tool/cloud_init.rb +3 -1
- data/lib/cloud_formation_tool/storable.rb +10 -7
- data/lib/cloud_formation_tool/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 719d1392da88b04a9b1ac703e2f53e45eb4c503e
|
4
|
+
data.tar.gz: 1b5d926090a8b5354aa73340df43d8081f83a2e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 418b750c8b9ab04c029ab098e1d11849dbce7e970cf51a83a38a20e1018f91cd52c11f60914bf17dab241589fa5b775ffb65b3bd6d3457a6721f465e928461c3
|
7
|
+
data.tar.gz: 3ec1c95e7b20db70f28f1b923a9b67287e64eddceebd846338feac3fdf5094a22c031d1b38602225fa84e9a65739a123b1db771056332047e4c207ea4486ecc9
|
@@ -10,7 +10,7 @@ module CloudFormationTool
|
|
10
10
|
log "Downloading Lambda code from #{url}"
|
11
11
|
res = fetch(url)
|
12
12
|
|
13
|
-
@s3_url = URI(upload(make_filename(url.split('.').last), res.body, res['content-type']))
|
13
|
+
@s3_url = URI(upload(make_filename(url.split('.').last), res.body, res['content-type'], false))
|
14
14
|
log "uploaded Lambda function to #{@s3_url}"
|
15
15
|
end
|
16
16
|
|
@@ -46,7 +46,7 @@ module CloudFormationTool
|
|
46
46
|
|
47
47
|
def create(template, params = {})
|
48
48
|
tmpl = CloudFormation.parse(template).to_yaml(params)
|
49
|
-
url = upload(make_filename('yaml'), tmpl)
|
49
|
+
url = upload(make_filename('yaml'), tmpl, false)
|
50
50
|
return update(url, template, params) if exist?
|
51
51
|
log "Creating stack '#{name}' from '#{template}' params #{params.inspect}"
|
52
52
|
resp = awscf.create_stack({
|
@@ -44,12 +44,14 @@ module CloudFormationTool
|
|
44
44
|
|
45
45
|
def encode(allow_gzip = true)
|
46
46
|
yamlout = compile
|
47
|
+
usegzip = false
|
47
48
|
if allow_gzip and yamlout.size > 16384 # max AWS EC2 user data size - try compressing it
|
48
49
|
yamlout = Zlib::Deflate.new(nil, 31).deflate(yamlout, Zlib::FINISH) # 31 is the magic word to have deflate create a gzip compatible header
|
50
|
+
usegzip = true
|
49
51
|
end
|
50
52
|
if yamlout.size > 16384 # still to big, we should upload to S3 and create an include file
|
51
53
|
url = upload make_filename('init'),
|
52
|
-
yamlout, 'text/cloud-config'
|
54
|
+
yamlout, 'text/cloud-config', usegzip
|
53
55
|
log "Wrote cloud config to #{url}"
|
54
56
|
[ "#include", url ].join "\n"
|
55
57
|
else
|
@@ -13,7 +13,7 @@ module CloudFormationTool
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
def upload(path, content, mime_type = 'text/yaml')
|
16
|
+
def upload(path, content, mime_type = 'text/yaml', gziped = true)
|
17
17
|
md5 = Digest::MD5.hexdigest content
|
18
18
|
prefix = "#{md5[0]}/#{md5[1..2]}/#{md5}"
|
19
19
|
b = Aws::S3::Bucket.new(s3_bucket_name(region), client: awss3(region))
|
@@ -26,12 +26,15 @@ module CloudFormationTool
|
|
26
26
|
if o.nil?
|
27
27
|
# no such luck, we need to actually upload the file
|
28
28
|
o = b.object("cf-compiled/#{prefix}/#{path}")
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
29
|
+
file_opts = {
|
30
|
+
acl: 'public-read',
|
31
|
+
body: content,
|
32
|
+
content_disposition: 'attachment',
|
33
|
+
content_type: mime_type,
|
34
|
+
storage_class: 'REDUCED_REDUNDANCY'
|
35
|
+
}
|
36
|
+
file_opts.merge!({content_encoding: 'gzip'}) if gziped
|
37
|
+
o.put(file_opts)
|
35
38
|
else
|
36
39
|
log "re-using cached object"
|
37
40
|
end
|