Permalink
Browse files

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

  • Loading branch information...
1 parent c71ab8a commit 3e5b3d051b313026e1ea3dbb74f091cf078d66f3 @mitchellh mitchellh committed Feb 21, 2012
Showing with 12 additions and 1 deletion.
  1. +12 −1 lib/vagrant/action/general/check_virtualbox.rb
@@ -8,7 +8,18 @@ def initialize(app, env)
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

0 comments on commit 3e5b3d0

Please sign in to comment.