Fix exception when adding boxes due to recent change. [GH-752]

This commit is contained in:
Mitchell Hashimoto 2012-02-20 17:26:22 -08:00
parent c71ab8a766
commit 3e5b3d051b
1 changed files with 12 additions and 1 deletions

View File

@ -8,7 +8,18 @@ module Vagrant
end
def call(env)
env[:vm].driver.verify!
# 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
end