cloudformation-tool 1.5.17 → 1.5.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/cftool +2 -2
- data/lib/cloud_formation_tool/cli/invalidate.rb +2 -2
- data/lib/cloud_formation_tool/cli/monitor.rb +2 -2
- data/lib/cloud_formation_tool/cli/recycle.rb +2 -2
- data/lib/cloud_formation_tool/cli/scale.rb +4 -4
- data/lib/cloud_formation_tool/cli/status.rb +2 -2
- data/lib/cloud_formation_tool/cloud_formation/lambda_code.rb +7 -7
- data/lib/cloud_formation_tool/storable.rb +2 -2
- data/lib/cloud_formation_tool/version.rb +1 -1
- data/lib/cloud_formation_tool.rb +3 -3
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b28a7b2fb0392256d47906dc9ded2b29dd967fd6f47caa122e353f175871435
|
4
|
+
data.tar.gz: 26c2e1ac7f2e63d95ba36a41de5fe3049816855d61872a84a0caf13e2fe2ddf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a3a556ea06d27db7ba7cbd74e818cd32534bb873d700c3d8af91b4a8fa42222d86876507c8cdfd67750d150d0297323933f2896b592dfaf06a40225c0b74e91
|
7
|
+
data.tar.gz: ec3b254d3f0fc493a5d4cd832559203434133bfd3f8048dbdb3d330aacc2b16ada30364508ee6a1b0b542e5cb377f11e20e5d4459a72fd45fd58e422fd4599d3
|
data/bin/cftool
CHANGED
@@ -5,9 +5,9 @@ require 'cloud_formation_tool'
|
|
5
5
|
begin
|
6
6
|
CloudFormationTool::CLI::Main.run
|
7
7
|
rescue SocketError => e
|
8
|
-
|
8
|
+
_warn "Networking error: #{e.message}"
|
9
9
|
exit 1
|
10
10
|
rescue CloudFormationTool::Errors::BaseError => e
|
11
|
-
|
11
|
+
_warn e.message
|
12
12
|
exit 1
|
13
13
|
end
|
@@ -16,8 +16,8 @@ module CloudFormationTool
|
|
16
16
|
inv.wait
|
17
17
|
log "Invalidation #{inv.id}: #{inv.status}"
|
18
18
|
end
|
19
|
-
end.each(&:join).length > 0 or
|
19
|
+
end.each(&:join).length > 0 or _error "No valid CloudFront distributions found"
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
23
|
-
end
|
23
|
+
end
|
@@ -16,7 +16,7 @@ module CloudFormationTool
|
|
16
16
|
sleep 1
|
17
17
|
end
|
18
18
|
rescue CloudFormationTool::Errors::StackDoesNotExistError => e
|
19
|
-
|
19
|
+
_error "Stack #{stack_name} does not exist"
|
20
20
|
rescue SystemExit, Interrupt => e
|
21
21
|
# CTRL-C out of the loop
|
22
22
|
puts "\n"
|
@@ -25,4 +25,4 @@ module CloudFormationTool
|
|
25
25
|
|
26
26
|
end
|
27
27
|
end
|
28
|
-
end
|
28
|
+
end
|
@@ -31,8 +31,8 @@ module CloudFormationTool
|
|
31
31
|
puts "#{grp.name}: Left to recycle - #{torecycle}"
|
32
32
|
end
|
33
33
|
end
|
34
|
-
end.each(&:join).length > 0 or
|
34
|
+
end.each(&:join).length > 0 or _error "No valid Autoscaling groups found named #{asg_name}"
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
38
|
-
end
|
38
|
+
end
|
@@ -22,16 +22,16 @@ module CloudFormationTool
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def execute
|
25
|
-
|
25
|
+
_debug "Starting scale operations"
|
26
26
|
st = CloudFormation::Stack.new(stack_name)
|
27
27
|
st.asgroups.select do |res|
|
28
|
-
|
28
|
+
_debug "Checking group #{res.logical_resource_id}"
|
29
29
|
asg_name.nil? or (res.logical_resource_id == asg_name)
|
30
30
|
end.collect do |res|
|
31
|
-
|
31
|
+
_debug "Scaling #{res.logical_resource_id}"
|
32
32
|
Thread.new do
|
33
33
|
grp = res.group
|
34
|
-
|
34
|
+
_debug "Current capacity: #{grp.desired_capacity}, setting to #{scale}"
|
35
35
|
grp.set_desired_capacity(desired_capacity: scale)
|
36
36
|
last_state = nil
|
37
37
|
until stable_scale(grp, scale)
|
@@ -20,12 +20,12 @@ module CloudFormationTool
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def handle_url
|
23
|
-
|
23
|
+
_debug "Trying Lambda code from #{@data['Url']}"
|
24
24
|
@data['Url'] = url = @tpl.resolveVal(@data['Url'])
|
25
25
|
return unless url.is_a? String
|
26
26
|
log "Downloading Lambda code from #{url}"
|
27
27
|
if already_in_cache(url)
|
28
|
-
|
28
|
+
_debug "Reusing remote cached object instead of downloading"
|
29
29
|
else
|
30
30
|
res = fetch_from_url(url)
|
31
31
|
@s3_url = URI(upload(make_filename(url.split('.').last), res.body, mime_type: res['content-type'], gzip: false))
|
@@ -36,7 +36,7 @@ module CloudFormationTool
|
|
36
36
|
def handle_path
|
37
37
|
@data['Path'] = path = @tpl.resolveVal(@data['Path'])
|
38
38
|
return unless path.is_a? String
|
39
|
-
|
39
|
+
_debug "Reading Lambda code from #{path}"
|
40
40
|
path = if path.start_with? "/" then path else "#{@tpl.basedir}/#{path}" end
|
41
41
|
if File.directory?(path)
|
42
42
|
@s3_url = URI(upload(make_filename('zip'), zip_path(path), mime_type: 'application/zip', gzip: false))
|
@@ -69,7 +69,7 @@ module CloudFormationTool
|
|
69
69
|
def zip_path(path)
|
70
70
|
Zip::OutputStream.write_buffer do |zf|
|
71
71
|
rdir path do |ent|
|
72
|
-
|
72
|
+
_debug "Deflating #{ent}"
|
73
73
|
filepath = File.join(path,ent)
|
74
74
|
zf.put_next_entry ::Zip::Entry.new(nil, ent, nil, nil, nil, nil, nil, nil, ::Zip::DOSTime.at(File.mtime(filepath).to_i))
|
75
75
|
zf.write File.read(filepath)
|
@@ -93,7 +93,7 @@ module CloudFormationTool
|
|
93
93
|
break if check_cached(response['ETag']) # dont read the body if its already cached
|
94
94
|
when Net::HTTPRedirection then
|
95
95
|
location = response['location']
|
96
|
-
|
96
|
+
_debug "Cache check redirected to #{location}"
|
97
97
|
limit = limit - 1
|
98
98
|
response.body
|
99
99
|
url = URI(location)
|
@@ -137,7 +137,7 @@ module CloudFormationTool
|
|
137
137
|
response
|
138
138
|
when Net::HTTPRedirection then
|
139
139
|
location = response['location']
|
140
|
-
|
140
|
+
_debug "redirected to #{location}"
|
141
141
|
fetch_from_url_real(location, limit - 1)
|
142
142
|
else
|
143
143
|
raise CloudFormationTool::Errors::AppError, "Error downloading #{url}: #{response.value}"
|
@@ -178,4 +178,4 @@ module CloudFormationTool
|
|
178
178
|
end
|
179
179
|
|
180
180
|
end
|
181
|
-
end
|
181
|
+
end
|
@@ -47,10 +47,10 @@ module CloudFormationTool
|
|
47
47
|
file_opts.delete :acl
|
48
48
|
end
|
49
49
|
file_opts.merge!({content_encoding: 'gzip'}) if gzip
|
50
|
-
|
50
|
+
_debug "Uploading S3 object s3://#{b.name}/#{o.key}"
|
51
51
|
o.put(file_opts)
|
52
52
|
else
|
53
|
-
|
53
|
+
_debug "re-using cached object"
|
54
54
|
end
|
55
55
|
o.public_url
|
56
56
|
end
|
data/lib/cloud_formation_tool.rb
CHANGED
@@ -15,7 +15,7 @@ def log(message = nil, &block)
|
|
15
15
|
end)
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
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 = nil, &block)
|
|
23
23
|
end)
|
24
24
|
end
|
25
25
|
|
26
|
-
def
|
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 = nil, &block)
|
|
31
31
|
end)
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
34
|
+
def _error(message = nil, &block)
|
35
35
|
logger.error(if message.nil?
|
36
36
|
yield
|
37
37
|
else
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
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.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oded Arbel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: base64
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rake
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|