From b7f311b46d878da77e6424acbae38ad2f19e6c9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alab=C3=AA=20Duarte?= Date: Mon, 23 Feb 2015 21:03:47 -0300 Subject: Insteads of raising out, it installs the plugin if it is not installed as the first thing --- Vagrantfile | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'Vagrantfile') diff --git a/Vagrantfile b/Vagrantfile index 7ded6b89..c3f3b08a 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -4,6 +4,17 @@ # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! VAGRANTFILE_API_VERSION = "2" +new_plugin_installed = false +unless Vagrant.has_plugin?('vagrant-vbguest') + plugin = 'vagrant-vbguest' + puts "Missing plugin #{plugin}, installing..." + + `vagrant plugin install #{plugin}` + + new_plugin_installed = true +end +exec "vagrant #{ARGV.join' '}" if new_plugin_installed + Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # All Vagrant configuration is done here. The most common configuration # options are documented and commented below. For a complete reference, @@ -18,10 +29,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "leap-wheezy" - unless Vagrant.has_plugin?("vagrant-vbguest") - raise 'plugin vagrant-vbguest is not installed! Please run `vagrant plugin install vagrant-vbguest`' - end - config.vbguest.auto_update = false config.vm.define "source", primary: true do |source| -- cgit v1.2.3