awful 0.0.120 → 0.0.121
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/awful/auto_scaling.rb +18 -4
- data/lib/awful/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0013087de23aa3029310865e2261704ae16bb20
|
4
|
+
data.tar.gz: 18001ac5b7e3f83fae97b1c92e576f64d84eb273
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa50e851e9319d4b46bc793d6a3bdc8109dde45c09f5a1b074d73a646e0bac74c2aba7d340e02e63ca456f8416d35abe02dd95994ad4d22ac1390d7e6a448341
|
7
|
+
data.tar.gz: 8fc3e2222761bd4f995816377cc915cfc5ec9772bf6ef62b3d05724f1b497592ef97cc95cb98b76f9578914bcaf645eb4d6786ba8b563ba64a3947886c28445c
|
data/lib/awful/auto_scaling.rb
CHANGED
@@ -34,6 +34,10 @@ module Awful
|
|
34
34
|
asg.auto_scaling_group_name.match(name) or tag_name(asg, '').match(name)
|
35
35
|
end
|
36
36
|
end
|
37
|
+
|
38
|
+
def instance_lifecycle_state(*instance_ids)
|
39
|
+
autoscaling.describe_auto_scaling_instances(instance_ids: instance_ids).auto_scaling_instances.map(&:lifecycle_state)
|
40
|
+
end
|
37
41
|
end
|
38
42
|
|
39
43
|
desc 'ls [PATTERN]', 'list autoscaling groups with name matching PATTERN'
|
@@ -354,19 +358,29 @@ module Awful
|
|
354
358
|
end
|
355
359
|
end
|
356
360
|
|
361
|
+
desc 'wait ASG INSTANCES', 'wait for instances to enter given lifecycle state'
|
362
|
+
method_option :state, aliases: '-s', type: :string, default: 'InService', desc: 'poll until instances enter given lifecycle state'
|
363
|
+
method_option :period, aliases: '-p', type: :numeric, default: 5, desc: 'period between polls'
|
364
|
+
def wait(name, *instance_ids)
|
365
|
+
until instance_lifecycle_state(*instance_ids).all?{ |s| s == options[:state] }
|
366
|
+
puts "waiting for #{instance_ids.count} instances to enter state #{options[:state]}"
|
367
|
+
sleep options[:period]
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
357
371
|
desc 'enter_standby ASG INSTANCES', 'put instance(s) in standby mode'
|
358
372
|
method_option :decrement, type: :boolean, default: true, desc: 'should decrement desired capacity'
|
359
|
-
def enter_standby(name, *
|
373
|
+
def enter_standby(name, *instance_ids)
|
360
374
|
autoscaling.enter_standby(
|
361
375
|
auto_scaling_group_name: name,
|
362
|
-
instance_ids:
|
376
|
+
instance_ids: instance_ids,
|
363
377
|
should_decrement_desired_capacity: options[:decrement]
|
364
378
|
)
|
365
379
|
end
|
366
380
|
|
367
381
|
desc 'exit_standby ASG INSTANCES', 'remove instance(s) from standby mode'
|
368
|
-
def exit_standby(name, *
|
369
|
-
autoscaling.exit_standby(auto_scaling_group_name: name, instance_ids:
|
382
|
+
def exit_standby(name, *instance_ids)
|
383
|
+
autoscaling.exit_standby(auto_scaling_group_name: name, instance_ids: instance_ids)
|
370
384
|
end
|
371
385
|
end
|
372
386
|
end
|
data/lib/awful/version.rb
CHANGED