Module: VagrantVbguest::Helpers::Rebootable

Includes:
VmCompatible
Included in:
CommandCommons, Middleware
Defined in:
lib/vagrant-vbguest/rebootable.rb,
lib/vagrant-vbguest/vagrant_compat/vagrant_1_0/rebootable.rb,
lib/vagrant-vbguest/vagrant_compat/vagrant_1_1/rebootable.rb

Constant Summary collapse

@@rebooted =
{}

Class Method Summary collapse

Instance Method Summary collapse

Methods included from VmCompatible

#communicate, #driver

Class Method Details

.included(base) ⇒ Object



6
7
8
# File 'lib/vagrant-vbguest/rebootable.rb', line 6

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#reboot(vm, options) ⇒ Object

Raises:

  • (NotImplementedError)


29
30
31
# File 'lib/vagrant-vbguest/rebootable.rb', line 29

def reboot(vm, options)
  raise NotImplementedError
end

#reboot!(vm, options) ⇒ Object

executes the whole reboot process



15
16
17
# File 'lib/vagrant-vbguest/vagrant_compat/vagrant_1_0/rebootable.rb', line 15

def reboot!(vm, options)
  raise NotImplementedError
end

#reboot?(vm, options) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/vagrant-vbguest/rebootable.rb', line 16

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) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/vagrant-vbguest/rebootable.rb', line 12

def rebooted?(vm)
  !!@@rebooted[ self.class.vm_id(vm) ]
end