4

I recently noticed that I managed to have a version of Vagrant and VirtualBox installed that did not work with my Vagrantfile. Upgrading to the latest Vagrant & VirtualBox fixed the problem.

Is it possible to ensure minimum Vagrant and VirtualBox versions are installed before allowing vagrant up to launch?

linuts
  • 6,608
  • 4
  • 35
  • 37
Ville Mattila
  • 1,343
  • 3
  • 15
  • 28

1 Answers1

4

For Vagrant itself, there is built-in support:

Vagrant.require_version ">= 1.3.5"

For Virtualbox, you can run some code at the top of your Vagrantfile like this:

if Gem::Version.new(`VBoxManage --version`.strip) < 
Gem::Version.new('5.1.6')
  abort "Please upgrade Virtualbox to 5.1.6 or later!"
end
stefansundin
  • 2,826
  • 1
  • 20
  • 28