module VagrantVbguest::Helpers::Rebootable
Public Class Methods
included(base)
click to toggle source
# File lib/vagrant-vbguest/helpers/rebootable.rb, line 8 def self.included(base) base.extend(ClassMethods) end
Public Instance Methods
reboot(vm, options)
click to toggle source
# File lib/vagrant-vbguest/helpers/rebootable.rb, line 31 def reboot(vm, options) if reboot? vm, options simple_reboot = Vagrant::Action::Builder.new.tap do |b| b.use Vagrant::Action::Builtin::Call, Vagrant::Action::Builtin::GracefulHalt, :poweroff, :running do |env2, b2| if !env2[:result] b2.use VagrantPlugins::ProviderVirtualBox::Action::ForcedHalt end end b.use VagrantPlugins::ProviderVirtualBox::Action::Boot if defined?(Vagrant::Action::Builtin::WaitForCommunicator) b.use Vagrant::Action::Builtin::WaitForCommunicator, [:starting, :running] end end @env[:action_runner].run(simple_reboot, @env) end end
reboot!(vm, options)
click to toggle source
executes the whole reboot process
# File lib/vagrant-vbguest/helpers/rebootable.rb, line 49 def reboot!(vm, options) if reboot? vm, options vm.action(:reload, options) end end
reboot?(vm, options)
click to toggle source
# File lib/vagrant-vbguest/helpers/rebootable.rb, line 18 def reboot?(vm, options) if rebooted?(vm) vm.env.ui.error(I18n.t("vagrant_vbguest.restart_loop_guard_activated")) false elsif options[:auto_reboot] vm.env.ui.warn(I18n.t("vagrant_vbguest.restart_vm")) @@rebooted[ self.class.vm_id(vm) ] = true else vm.env.ui.warn(I18n.t("vagrant_vbguest.suggest_restart", :name => vm.name)) false end end
rebooted?(vm)
click to toggle source
# File lib/vagrant-vbguest/helpers/rebootable.rb, line 14 def rebooted?(vm) !!@@rebooted[ self.class.vm_id(vm) ] end