45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/cloud_formation_tool/cloud_init.rb', line 45
def encode(allow_gzip = true)
yamlout = compile
usegzip = false
if allow_gzip and yamlout.size > $MAX_USER_DATA_SIZE yamlout = Zlib::Deflate.new(nil, 31).deflate(yamlout, Zlib::FINISH) usegzip = true
end
if yamlout.size > $MAX_USER_DATA_SIZE url = upload make_filename('init'),
yamlout, mime_type: 'text/cloud-config', gzip: usegzip
log "Wrote cloud config to #{url}"
[ "#include", url ].join "\n"
else
yamlout
end
end
|