awful 0.0.8 → 0.0.9
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/lib/awful/auto_scaling.rb +6 -0
- data/lib/awful/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92b70a21086b26bd51cfa3ffc8b209921f18cf13
|
4
|
+
data.tar.gz: cdbfc2a8e6706e8b6376a10e690aa245d28fde79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05746b80eee6cccabd29818777eb98b96af940102c394d1d0cfed12e0821ea76a6eb94b2f82436437db008307eae2f705ff691277edc7a7b286bfa7b18634ad4
|
7
|
+
data.tar.gz: 2b23230430ab531817edcf810b761f8749171082e815722c4a8c1443410932c3aeb80f5d3f2d9d8f951e8fa2ec3a399619366873ffe99fbc510164d8494a475d
|
data/lib/awful/auto_scaling.rb
CHANGED
@@ -117,6 +117,8 @@ module Awful
|
|
117
117
|
end
|
118
118
|
|
119
119
|
no_commands do
|
120
|
+
|
121
|
+
## return array of instances in auto-scaling group sorted by age
|
120
122
|
def oldest(name)
|
121
123
|
instance_ids = autoscaling.describe_auto_scaling_instances.map(&:auto_scaling_instances).flatten.select do |instance|
|
122
124
|
instance.auto_scaling_group_name == name
|
@@ -124,16 +126,20 @@ module Awful
|
|
124
126
|
ec2.describe_instances(instance_ids: instance_ids).map(&:reservations).flatten.map(&:instances).flatten.sort_by(&:launch_time)
|
125
127
|
end
|
126
128
|
|
129
|
+
## return array of instances in auto-scaling group, reverse sorted by age, newest first
|
127
130
|
def newest(name)
|
128
131
|
oldest(name).reverse
|
129
132
|
end
|
133
|
+
|
130
134
|
end
|
131
135
|
|
132
136
|
desc 'terminate NAME [NUMBER]', 'terminate NUMBER instances in group NAME'
|
133
137
|
method_option :decrement, aliases: '-d', default: false, type: :boolean, desc: 'Decrement desired capacity for each terminated instance'
|
134
138
|
method_option :newest, aliases: '-n', default: false, type: :boolean, desc: 'Delete newest instances instead of oldest'
|
139
|
+
method_option :all, aliases: '-a', default: false, type: :boolean, desc: 'Terminate all instances in group'
|
135
140
|
def terminate(name, num = 1)
|
136
141
|
ins = options[:newest] ? newest(name) : oldest(name)
|
142
|
+
num = ins.length if options[:all] # all instances if requested
|
137
143
|
|
138
144
|
ins.first(num.to_i).map(&:instance_id).tap do |ids|
|
139
145
|
if yes? "Really terminate #{num} instances: #{ids.join(',')}?", :yellow
|
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.9
|
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-03-
|
11
|
+
date: 2015-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|