Class: Vagrant::Action::General::CheckVirtualbox

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant/action/general/check_virtualbox.rb

Overview

Checks that virtualbox is installed and ready to be used.

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ CheckVirtualbox

Returns a new instance of CheckVirtualbox.



6
7
8
# File 'lib/vagrant/action/general/check_virtualbox.rb', line 6

def initialize(app, env)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/vagrant/action/general/check_virtualbox.rb', line 10

def call(env)
  # Certain actions may not actually have a VM, and thus no
  # driver, so we have to be clever about obtaining an instance
  # of the driver.
  driver = nil
  driver = env[:vm].driver if env[:vm]
  driver = Driver::VirtualBox.new(nil) if !driver

  # Verify that it is ready to go! This will raise an exception
  # if anything goes wrong.
  driver.verify!

  # Carry on.
  @app.call(env)
end