awful 0.0.18 → 0.0.19

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 63e2c2d2613cc6d46e8381310a6f6472cb23c7e8
4
- data.tar.gz: 72c0e79eb528599b66356a6a6867a5ca0571c959
3
+ metadata.gz: e3c48ef8ad16b349fc7e1d0d15a8cf17e4ea7a67
4
+ data.tar.gz: 8382b4c4a018639909af71234e1b7efffb2b3b35
5
5
  SHA512:
6
- metadata.gz: d5ff883d31896a42ae60e6319f38cef5a52e6ddd4684eb8963e73338c9ccd5d4b6da9cb0100c6100252cb0dbf917159031b5cf1e82fa92a2e917edea0c87fefa
7
- data.tar.gz: e5568b15699fee31554ad0a908f42e52656ab4ee915aa273814e0be1bdb166623e29cba22fbdaefb5d031a9d778d6223dac63bd0d82376ada197471955cf8bd4
6
+ metadata.gz: 47ed8385d4cfe2d8d48e7499f27ed2b5874c871ef48ea5a1dadfe1bbfaca6cf6b509fa3c64f8f70f3468d52cf14b273d54cff8f19192612b09011a49fea01f66
7
+ data.tar.gz: 3aa7f6b767cdef46965e4681aef007612003de1c74a9f708872b052d874c768c69f7144c8449654199bdff90554255ab213e3caeaa897e4f4b85ce1b67542a0f
@@ -11,13 +11,12 @@ module Awful
11
11
  end
12
12
 
13
13
  if options[:long]
14
- fields = %w[ @name @creationTime ]
15
14
  datapipeline.describe_pipelines(pipeline_ids: dps.map(&:id)).pipeline_description_list.map do |dp|
16
15
  dp.fields.each_with_object({}) do |f, h|
17
16
  h[f.key] = f.string_value # convert array of structs to hash
18
- end
17
+ end.merge('id' => dp.pipeline_id)
19
18
  end.tap do |list|
20
- print_table list.map { |d| d.values_at('@creationTime', 'name', '@pipelineState', '@healthStatus') }.sort
19
+ print_table list.map { |d| d.values_at('@creationTime', 'id', '@pipelineState', '@healthStatus', 'name') }.sort
21
20
  end
22
21
  else
23
22
  puts dps.map(&:name).sort
data/lib/awful/elb.rb CHANGED
@@ -19,17 +19,22 @@ module Awful
19
19
  end
20
20
 
21
21
  desc 'instances NAME', 'list instances and states for elb NAME'
22
+ method_option :long, aliases: '-l', default: false, desc: 'Long listing'
22
23
  def instances(name)
23
24
  instances = elb.describe_instance_health(load_balancer_name: name).map(&:instance_states).flatten
24
25
  if instances.empty?
25
- puts 'no instances'
26
+ instances.tap { puts 'no instances' }
26
27
  else
27
28
  instances_by_id = instances.inject({}) { |hash,instance| hash[instance.instance_id] = instance; hash }
28
- ec2.describe_instances(instance_ids: instances_by_id.keys).map(&:reservations).flatten.map(&:instances).flatten.map do |instance|
29
- health = instances_by_id[instance.instance_id]
30
- [ instance.tags.map(&:value).sort.join(','), instance.public_ip_address, health.state, health.reason_code, health.description ]
31
- end.tap do |list|
32
- print_table list
29
+ if options[:long]
30
+ ec2.describe_instances(instance_ids: instances_by_id.keys).map(&:reservations).flatten.map(&:instances).flatten.map do |instance|
31
+ health = instances_by_id[instance.instance_id]
32
+ [ instance.instance_id, instance.tags.map(&:value).sort.join(','), instance.public_ip_address, health.state, health.reason_code, health.description ]
33
+ end.tap do |list|
34
+ print_table list
35
+ end
36
+ else
37
+ instances_by_id.keys.tap { |list| puts list }
33
38
  end
34
39
  end
35
40
  end
@@ -93,6 +98,18 @@ module Awful
93
98
  elb.deregister_instances_from_load_balancer(load_balancer_name: name, instances: instance_ids.map{ |id| {instance_id: id} })
94
99
  end
95
100
 
101
+ desc 'state [INSTANCE_IDS]', 'show health state for all instances, or listed instance ids'
102
+ method_option :long, aliases: '-l', default: false, desc: 'Long listing'
103
+ def state(name, *instance_ids)
104
+ elb.describe_instance_health(load_balancer_name: name, instances: instance_ids.map { |id| {instance_id: id} }).instance_states.tap do |instances|
105
+ if options[:long]
106
+ print_table instances.map { |i| [ i.instance_id, i.state, i.reason_code, i.description ] }
107
+ else
108
+ puts instances.map { |i| i.state }
109
+ end
110
+ end
111
+ end
112
+
96
113
  end
97
114
 
98
115
  end
data/lib/awful/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Awful
2
- VERSION = "0.0.18"
2
+ VERSION = "0.0.19"
3
3
  end
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.18
4
+ version: 0.0.19
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-07-11 00:00:00.000000000 Z
11
+ date: 2015-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler