awful 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64808f5ad8cd115aafd870f9dc89fd583b83cb8b
4
- data.tar.gz: ba8ca53a1fb56bb13501de414fe57e389f3df0a4
3
+ metadata.gz: 6f0703571ca89556e9efc56775170d18aaab6373
4
+ data.tar.gz: 646f54dd08e397f6ea1ad1210ab66ab0c91a86f9
5
5
  SHA512:
6
- metadata.gz: a90c817d1f6f7f9c18be681cae6942b543dda5e66772097934dc69e601fcb4c49353bccf8ebc88f7de5e8b902098f968d11ca71c09f85067b0ae7342cc91f208
7
- data.tar.gz: c5070773d7307abb9657650b60825e6ab6da423eb7332d9e944215696343ea61b8799c222a267373a2b3f20dfa2c3c55354eaa80cd858694f06d2c9e776f1802
6
+ metadata.gz: 8ed049a0836cc96f60bebeed84562b1ded715cd322a0573a4c550f3d29d7e0e56cc6b63e81e06b460256ffc47489aa3c5fe5d281aac66b4df9ba8152fb6459c8
7
+ data.tar.gz: 667c2ad1e33fb85855a5f9e3def233cc5b45b1d9b0b800beeda9d1980190e1a893c0b3af3ae5c424156dd15928fdddf683bf9525fd36b1ab4c05ac3dd819de86
@@ -138,7 +138,11 @@ module Awful
138
138
  instance_ids = autoscaling.describe_auto_scaling_instances.map(&:auto_scaling_instances).flatten.select do |instance|
139
139
  instance.auto_scaling_group_name == name
140
140
  end.map(&:instance_id)
141
- ec2.describe_instances(instance_ids: instance_ids).map(&:reservations).flatten.map(&:instances).flatten.sort_by(&:launch_time)
141
+ if instance_ids.empty?
142
+ []
143
+ else
144
+ ec2.describe_instances(instance_ids: instance_ids).map(&:reservations).flatten.map(&:instances).flatten.sort_by(&:launch_time)
145
+ end
142
146
  end
143
147
 
144
148
  ## return array of instances in auto-scaling group, reverse sorted by age, newest first
@@ -156,7 +160,10 @@ module Awful
156
160
  ins = options[:newest] ? newest(name) : oldest(name)
157
161
  num = ins.length if options[:all] # all instances if requested
158
162
 
159
- ins.first(num.to_i).map(&:instance_id).tap do |ids|
163
+ if ins.empty?
164
+ say 'No instances to terminate.', :green
165
+ else
166
+ ids = ins.first(num.to_i).map(&:instance_id)
160
167
  if yes? "Really terminate #{num} instances: #{ids.join(',')}?", :yellow
161
168
  ids.each do |id|
162
169
  autoscaling.terminate_instance_in_auto_scaling_group(instance_id: id, should_decrement_desired_capacity: options[:decrement] && true)
@@ -1,3 +1,3 @@
1
1
  module Awful
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awful
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ric Lister
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  version: '0'
129
129
  requirements: []
130
130
  rubyforge_project:
131
- rubygems_version: 2.2.3
131
+ rubygems_version: 2.2.2
132
132
  signing_key:
133
133
  specification_version: 4
134
134
  summary: Simple AWS command-line tool.