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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8111825f086974f7ece218790ecc38b89d02cb80
4
- data.tar.gz: b10cf42a491819e0fb64050078143bae344ea9bb
3
+ metadata.gz: c0013087de23aa3029310865e2261704ae16bb20
4
+ data.tar.gz: 18001ac5b7e3f83fae97b1c92e576f64d84eb273
5
5
  SHA512:
6
- metadata.gz: 3ea9e3ed8a36d93e56d5eb13041a8f17190c24c176bf710f629bdc532d3515bb28f9ed7e7d6109d19ee3334b86762e86fd8fcd1b093ba496a96b624f3f357810
7
- data.tar.gz: e42f0889a948a82f0ae1150e2fcca7f872ffe115022802a474ce05ce66c84004fea715e6bdb3d3c5497badafa5ac74df6b02e008155fda6af1539c924003d5c6
6
+ metadata.gz: aa50e851e9319d4b46bc793d6a3bdc8109dde45c09f5a1b074d73a646e0bac74c2aba7d340e02e63ca456f8416d35abe02dd95994ad4d22ac1390d7e6a448341
7
+ data.tar.gz: 8fc3e2222761bd4f995816377cc915cfc5ec9772bf6ef62b3d05724f1b497592ef97cc95cb98b76f9578914bcaf645eb4d6786ba8b563ba64a3947886c28445c
@@ -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, *instances)
373
+ def enter_standby(name, *instance_ids)
360
374
  autoscaling.enter_standby(
361
375
  auto_scaling_group_name: name,
362
- instance_ids: instances,
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, *instances)
369
- autoscaling.exit_standby(auto_scaling_group_name: name, instance_ids: instances)
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
@@ -1,3 +1,3 @@
1
1
  module Awful
2
- VERSION = '0.0.120'
2
+ VERSION = '0.0.121'
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.120
4
+ version: 0.0.121
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ric Lister