Make sure a driver is always set on a VM object

This commit is contained in:
Mitchell Hashimoto 2012-03-05 20:42:55 -08:00
parent 97cf6ddfba
commit 40901dc2e6
1 changed files with 5 additions and 3 deletions

View File

@ -128,10 +128,12 @@ module Vagrant
begin
@driver = Driver::VirtualBox.new(@uuid)
rescue Driver::VirtualBox::VMNotFound
# Clear the UUID since this VM doesn't exist. Note that this calls
# back into `reload!` but shouldn't ever result in infinite
# recursion since `@uuid` will be nil.
# Clear the UUID since this VM doesn't exist.
@uuid = nil
# Reset the driver. This shouldn't raise a VMNotFound since we won't
# feed it a UUID.
@driver = Driver::VirtualBox.new
end
end