awful 0.0.51 → 0.0.52
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/bin/ecs +7 -0
- data/lib/awful/cloudformation.rb +4 -1
- data/lib/awful/ecs.rb +67 -0
- data/lib/awful/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 250b30414e77e87830cc9ec2422af351a073a28a
|
4
|
+
data.tar.gz: 52d5c1cad70199c2bc205dd8c8d863ab7659261d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0bd67f11073df6f92d6ce1933b98df9c6867e376afe200ad0fc75bcfb17ba24eac88189e700fa995a38882f51750c12c58d96bc039f5eacbcef4f69696a06f0
|
7
|
+
data.tar.gz: 60c43fc00df65857509f6ec8bc5c946c42fc449318453b8516ea2410a772df75dc79cea0b21b56cf1464b9160086a6c4c10d18fd4ef4ff0cb0d9f6a484f92870
|
data/bin/ecs
ADDED
data/lib/awful/cloudformation.rb
CHANGED
@@ -111,8 +111,11 @@ module Awful
|
|
111
111
|
|
112
112
|
desc 'resources NAME', 'list resources for stack with name NAME'
|
113
113
|
method_option :long, aliases: '-l', default: false, desc: 'Long listing'
|
114
|
+
method_option :type, aliases: '-t', default: '.', desc: 'Filter by regex matching type of resource'
|
114
115
|
def resources(name)
|
115
|
-
cf.list_stack_resources(stack_name: name).stack_resource_summaries.
|
116
|
+
cf.list_stack_resources(stack_name: name).stack_resource_summaries.select do |resource|
|
117
|
+
resource.resource_type.match(/#{options[:type]}/i)
|
118
|
+
end.tap do |resources|
|
116
119
|
if options[:long]
|
117
120
|
print_table resources.map { |r| [r.logical_resource_id, r.physical_resource_id, r.resource_type, color(r.resource_status), r.resource_status_reason] }
|
118
121
|
else
|
data/lib/awful/ecs.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
module Awful
|
2
|
+
|
3
|
+
class Ecs < Cli
|
4
|
+
|
5
|
+
COLORS = {
|
6
|
+
ACTIVE: :green,
|
7
|
+
INACTIVE: :red,
|
8
|
+
}
|
9
|
+
|
10
|
+
no_commands do
|
11
|
+
def ecs
|
12
|
+
@ecs ||= Aws::ECS::Client.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def color(string)
|
16
|
+
set_color(string, COLORS.fetch(string.to_sym, :yellow))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'ls NAME', 'list ECS clusters'
|
21
|
+
method_option :arns, aliases: '-a', default: false, desc: 'List just ARNs'
|
22
|
+
method_option :long, aliases: '-l', default: false, desc: 'Long listing'
|
23
|
+
def ls(name = '.')
|
24
|
+
arns = ecs.list_clusters.cluster_arns.select do |arn|
|
25
|
+
arn.split('/').last.match(/#{name}/i)
|
26
|
+
end
|
27
|
+
ecs.describe_clusters(clusters: arns).clusters.tap do |clusters|
|
28
|
+
if options[:arns]
|
29
|
+
puts arns
|
30
|
+
elsif options[:long]
|
31
|
+
print_table clusters.map { |c|
|
32
|
+
[
|
33
|
+
c.cluster_name,
|
34
|
+
color(c.status),
|
35
|
+
"instances:#{c.registered_container_instances_count}",
|
36
|
+
"pending:#{c.pending_tasks_count}",
|
37
|
+
"running:#{c.running_tasks_count}",
|
38
|
+
]
|
39
|
+
}
|
40
|
+
else
|
41
|
+
puts clusters.map(&:cluster_name).sort
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
desc 'instances CLUSTER', 'list instances for CLUSTER'
|
47
|
+
method_option :long, aliases: '-l', default: false, desc: 'Long listing'
|
48
|
+
def instances(cluster)
|
49
|
+
arns = ecs.list_container_instances(cluster: cluster).container_instance_arns
|
50
|
+
if options[:long]
|
51
|
+
container_instances = ecs.describe_container_instances(cluster: cluster, container_instances: arns).container_instances
|
52
|
+
ec2_instances = ec2.describe_instances(instance_ids: container_instances.map(&:ec2_instance_id)).map(&:reservations).flatten.map(&:instances).flatten
|
53
|
+
print_table container_instances.each_with_index.map { |ins, i|
|
54
|
+
[
|
55
|
+
tag_name(ec2_instances[i]),
|
56
|
+
ins.container_instance_arn.split('/').last,
|
57
|
+
ins.ec2_instance_id,
|
58
|
+
"agent:#{ins.agent_connected}",
|
59
|
+
color(ins.status),
|
60
|
+
]
|
61
|
+
}
|
62
|
+
else
|
63
|
+
puts arns
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
data/lib/awful/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awful
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.52
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ric Lister
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -92,6 +92,7 @@ executables:
|
|
92
92
|
- dyn
|
93
93
|
- dynstr
|
94
94
|
- ec2
|
95
|
+
- ecs
|
95
96
|
- elb
|
96
97
|
- lambda
|
97
98
|
- lc
|
@@ -120,6 +121,7 @@ files:
|
|
120
121
|
- bin/dyn
|
121
122
|
- bin/dynstr
|
122
123
|
- bin/ec2
|
124
|
+
- bin/ecs
|
123
125
|
- bin/elb
|
124
126
|
- bin/lambda
|
125
127
|
- bin/lc
|
@@ -140,6 +142,7 @@ files:
|
|
140
142
|
- lib/awful/dynamodb.rb
|
141
143
|
- lib/awful/dynamodb_streams.rb
|
142
144
|
- lib/awful/ec2.rb
|
145
|
+
- lib/awful/ecs.rb
|
143
146
|
- lib/awful/elb.rb
|
144
147
|
- lib/awful/lambda.rb
|
145
148
|
- lib/awful/launch_config.rb
|