Sha256: 58fa4bb77f0ce4f07063000f19abf7a081b0e3880c9843c5079b18367e061e58
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
require "log4r" module VagrantPlugins module GuestLinux module Cap class Reboot MAX_REBOOT_RETRY_DURATION = 120 def self.reboot(machine) @logger = Log4r::Logger.new("vagrant::linux::reboot") reboot_script = "reboot" comm = machine.communicate @logger.debug("Issuing reboot command for guest") comm.sudo(reboot_script) machine.ui.info(I18n.t("vagrant.guests.capabilities.rebooting")) @logger.debug("Waiting for machine to finish rebooting") wait_remaining = MAX_REBOOT_RETRY_DURATION begin wait_for_reboot(machine) rescue Vagrant::Errors::MachineGuestNotReady => e raise if wait_remaining < 0 @logger.warn("Machine not ready, cannot start reboot yet. Trying again") sleep(5) wait_remaining -= 5 retry end end def self.wait_for_reboot(machine) while !machine.guest.ready? sleep 10 end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vagrant-unbundled-2.2.7.0 | plugins/guests/linux/cap/reboot.rb |