Class: Asg::Rebooter::InstanceRebooter
- Inherits:
-
Object
- Object
- Asg::Rebooter::InstanceRebooter
- Defined in:
- lib/asg/rebooter/instance_rebooter.rb
Constant Summary collapse
- REBOOT_TIMEOUT =
60
Instance Attribute Summary collapse
-
#asg ⇒ Object
readonly
Returns the value of attribute asg.
-
#asg_config ⇒ Object
readonly
Returns the value of attribute asg_config.
-
#target_group_config ⇒ Object
readonly
Returns the value of attribute target_group_config.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(asg) ⇒ InstanceRebooter
constructor
A new instance of InstanceRebooter.
Constructor Details
#initialize(asg) ⇒ InstanceRebooter
Returns a new instance of InstanceRebooter.
8 9 10 |
# File 'lib/asg/rebooter/instance_rebooter.rb', line 8 def initialize(asg) @asg = asg end |
Instance Attribute Details
#asg ⇒ Object (readonly)
Returns the value of attribute asg.
6 7 8 |
# File 'lib/asg/rebooter/instance_rebooter.rb', line 6 def asg @asg end |
#asg_config ⇒ Object (readonly)
Returns the value of attribute asg_config.
6 7 8 |
# File 'lib/asg/rebooter/instance_rebooter.rb', line 6 def asg_config @asg_config end |
#target_group_config ⇒ Object (readonly)
Returns the value of attribute target_group_config.
6 7 8 |
# File 'lib/asg/rebooter/instance_rebooter.rb', line 6 def target_group_config @target_group_config end |
Instance Method Details
#execute ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/asg/rebooter/instance_rebooter.rb', line 12 def execute puts "[start] Starting reboot sequence for: #{asg.name}" begin prepare_configuration instances.each do |instance| puts "#{'*' * 4} #{instance.instance_id} #{'*' * 4}" puts "#{instance.instance_id} [enter_standby]" instance.enter_standby puts "#{instance.instance_id} [reboot]" instance.reboot sleep REBOOT_TIMEOUT # TODO: Ensure instance is rebooted: how to do this? puts "#{instance.instance_id} [exit_standby]" instance.exit_standby puts "#{instance.instance_id} [wait_for_healthy]" target_group.wait_for_healthy(instance) puts "\n" end ensure restore_configuration end end |