ufo 4.3.0 → 4.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +11 -10
- data/docs/_reference/ufo-ps.md +2 -0
- data/lib/ufo/cli.rb +1 -0
- data/lib/ufo/ps.rb +30 -6
- data/lib/ufo/version.rb +1 -1
- data/spec/lib/ps_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4dfad82bcb8f29c81c11bec2298b540885b11337abf57b25371f4068a474b02
|
4
|
+
data.tar.gz: 352909476cc73ddab7f16a88bc5878b3be7a7f8bfdff85d22856570a0d7be5e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d3cbfbd3ea2ce9622995c61e862188d5f0f7f67afe4bca7c9261f056d7f4b33edec6ba4e389198220007c376fab155dfc6c8d02fe8d1dc7c39df0a8fb4b5fc6
|
7
|
+
data.tar.gz: '09a4f4fc612c3f4ebcb782bc6fe146ebfb88b75bb5cfab5e55f712158fef225b18c11fd759c649a4bb7bf361655ccf750152d5e626fede67331a0c9d6dc23443'
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [4.3.1]
|
7
|
+
- #70 ps --status filter and fix list_tasks 100 limit issue
|
8
|
+
|
6
9
|
## [4.3.0]
|
7
10
|
- Default starter ecs ec2 template to networkMode awsvpc
|
8
11
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ufo (4.
|
4
|
+
ufo (4.3.1)
|
5
5
|
aws-sdk-cloudformation
|
6
6
|
aws-sdk-cloudwatchlogs
|
7
7
|
aws-sdk-ec2
|
@@ -19,17 +19,17 @@ PATH
|
|
19
19
|
GEM
|
20
20
|
remote: https://rubygems.org/
|
21
21
|
specs:
|
22
|
-
activesupport (5.2.2)
|
22
|
+
activesupport (5.2.2.1)
|
23
23
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
24
24
|
i18n (>= 0.7, < 2)
|
25
25
|
minitest (~> 5.1)
|
26
26
|
tzinfo (~> 1.1)
|
27
|
-
aws-eventstream (1.0.
|
28
|
-
aws-partitions (1.
|
27
|
+
aws-eventstream (1.0.2)
|
28
|
+
aws-partitions (1.144.0)
|
29
29
|
aws-sdk-cloudformation (1.14.0)
|
30
30
|
aws-sdk-core (~> 3, >= 3.39.0)
|
31
31
|
aws-sigv4 (~> 1.0)
|
32
|
-
aws-sdk-cloudwatchlogs (1.
|
32
|
+
aws-sdk-cloudwatchlogs (1.14.0)
|
33
33
|
aws-sdk-core (~> 3, >= 3.39.0)
|
34
34
|
aws-sigv4 (~> 1.0)
|
35
35
|
aws-sdk-core (3.46.2)
|
@@ -37,28 +37,29 @@ GEM
|
|
37
37
|
aws-partitions (~> 1.0)
|
38
38
|
aws-sigv4 (~> 1.0)
|
39
39
|
jmespath (~> 1.0)
|
40
|
-
aws-sdk-ec2 (1.
|
40
|
+
aws-sdk-ec2 (1.72.0)
|
41
41
|
aws-sdk-core (~> 3, >= 3.39.0)
|
42
42
|
aws-sigv4 (~> 1.0)
|
43
43
|
aws-sdk-ecr (1.11.0)
|
44
44
|
aws-sdk-core (~> 3, >= 3.39.0)
|
45
45
|
aws-sigv4 (~> 1.0)
|
46
|
-
aws-sdk-ecs (1.
|
46
|
+
aws-sdk-ecs (1.31.0)
|
47
47
|
aws-sdk-core (~> 3, >= 3.39.0)
|
48
48
|
aws-sigv4 (~> 1.0)
|
49
49
|
aws-sdk-elasticloadbalancingv2 (1.21.0)
|
50
50
|
aws-sdk-core (~> 3, >= 3.39.0)
|
51
51
|
aws-sigv4 (~> 1.0)
|
52
|
-
aws-sigv4 (1.0
|
52
|
+
aws-sigv4 (1.1.0)
|
53
|
+
aws-eventstream (~> 1.0, >= 1.0.2)
|
53
54
|
byebug (11.0.0)
|
54
55
|
cli_markdown (0.1.0)
|
55
56
|
codeclimate-test-reporter (1.0.9)
|
56
57
|
simplecov (<= 0.13)
|
57
|
-
concurrent-ruby (1.1.
|
58
|
+
concurrent-ruby (1.1.5)
|
58
59
|
deep_merge (1.2.1)
|
59
60
|
diff-lcs (1.3)
|
60
61
|
docile (1.1.5)
|
61
|
-
i18n (1.
|
62
|
+
i18n (1.6.0)
|
62
63
|
concurrent-ruby (~> 1.0)
|
63
64
|
jmespath (1.4.0)
|
64
65
|
json (2.2.0)
|
data/docs/_reference/ufo-ps.md
CHANGED
@@ -46,6 +46,8 @@ Skip the summary info:
|
|
46
46
|
[--summary], [--no-summary] # Display summary header info.
|
47
47
|
# Default: true
|
48
48
|
[--extra], [--no-extra] # Display extra debugging columns.
|
49
|
+
[--status=STATUS] # Status filter: all, pending, stopped, running.
|
50
|
+
# Default: all
|
49
51
|
[--verbose], [--no-verbose]
|
50
52
|
[--mute], [--no-mute]
|
51
53
|
[--noop], [--no-noop]
|
data/lib/ufo/cli.rb
CHANGED
@@ -163,6 +163,7 @@ module Ufo
|
|
163
163
|
long_desc Help.text(:ps)
|
164
164
|
option :summary, type: :boolean, default: true, desc: "Display summary header info."
|
165
165
|
option :extra, type: :boolean, default: false, desc: "Display extra debugging columns."
|
166
|
+
option :status, default: "all", desc: "Status filter: all, pending, stopped, running."
|
166
167
|
def ps(service=:current)
|
167
168
|
Ps.new(service, options).run
|
168
169
|
end
|
data/lib/ufo/ps.rb
CHANGED
@@ -13,14 +13,18 @@ module Ufo
|
|
13
13
|
end
|
14
14
|
|
15
15
|
summary
|
16
|
+
|
16
17
|
if task_arns.empty?
|
17
18
|
puts "There are 0 running tasks."
|
18
19
|
return
|
19
20
|
end
|
20
21
|
|
21
|
-
|
22
|
-
|
22
|
+
all_task_arns = task_arns.each_slice(100).map do |arns|
|
23
|
+
resp = ecs.describe_tasks(tasks: arns, cluster: @cluster)
|
24
|
+
resp["tasks"]
|
25
|
+
end.flatten
|
23
26
|
|
27
|
+
display_tasks(all_task_arns)
|
24
28
|
display_scale_help
|
25
29
|
display_target_group_help
|
26
30
|
end
|
@@ -79,11 +83,11 @@ module Ufo
|
|
79
83
|
end
|
80
84
|
end
|
81
85
|
|
82
|
-
def display_tasks(
|
86
|
+
def display_tasks(tasks)
|
83
87
|
table = Text::Table.new
|
84
88
|
Task.extra_columns = @options[:extra]
|
85
89
|
table.head = Task.header
|
86
|
-
tasks =
|
90
|
+
tasks = tasks.sort_by { |t| t["task_arn"] }
|
87
91
|
tasks.each do |t|
|
88
92
|
task = Task.new(t)
|
89
93
|
table.rows << task.to_a unless task.hide?
|
@@ -91,17 +95,37 @@ module Ufo
|
|
91
95
|
puts table
|
92
96
|
end
|
93
97
|
|
98
|
+
def statuses
|
99
|
+
status = @options[:status].upcase
|
100
|
+
valid_statuses = %w[RUNNING PENDING STOPPED]
|
101
|
+
all_statuses = valid_statuses + ["ALL"]
|
102
|
+
unless all_statuses.include?(status)
|
103
|
+
puts "Invalid status filter provided. Please provided one of the following:"
|
104
|
+
puts all_statuses.map(&:downcase).join(", ")
|
105
|
+
exit 1
|
106
|
+
end
|
107
|
+
|
108
|
+
status == "ALL" ? valid_statuses : [status]
|
109
|
+
end
|
110
|
+
|
94
111
|
def task_arns
|
95
112
|
threads, results = [], {}
|
96
|
-
statuses = %w[RUNNING PENDING STOPPED]
|
97
113
|
statuses.each do |status|
|
98
114
|
threads << Thread.new do
|
99
|
-
|
115
|
+
options = {
|
116
|
+
service_name: service.service_name,
|
117
|
+
cluster: @cluster,
|
118
|
+
desired_status: status,
|
119
|
+
}
|
120
|
+
# Limit display of too many stopped tasks
|
121
|
+
options[:max_results] = 20 if status == "STOPPED"
|
122
|
+
resp = ecs.list_tasks(options)
|
100
123
|
results[status] = resp.task_arns
|
101
124
|
end
|
102
125
|
end
|
103
126
|
threads.map(&:join)
|
104
127
|
results.values.flatten.uniq
|
105
128
|
end
|
129
|
+
memoize :task_arns
|
106
130
|
end
|
107
131
|
end
|
data/lib/ufo/version.rb
CHANGED
data/spec/lib/ps_spec.rb
CHANGED
@@ -4,11 +4,11 @@ describe Ufo::Ps do
|
|
4
4
|
end
|
5
5
|
|
6
6
|
context "running tasks" do
|
7
|
-
let(:
|
8
|
-
JSON.load(IO.read("spec/fixtures/ps/describe_tasks.json"))
|
7
|
+
let(:task_arns) do
|
8
|
+
JSON.load(IO.read("spec/fixtures/ps/describe_tasks.json"))["tasks"]
|
9
9
|
end
|
10
10
|
it "display_tasks" do
|
11
|
-
ps.display_tasks(
|
11
|
+
ps.display_tasks(task_arns)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ufo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.3.
|
4
|
+
version: 4.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-cloudformation
|