diff --git a/plugins/providers/virtualbox/action/check_guest_additions.rb b/plugins/providers/virtualbox/action/check_guest_additions.rb index d6a388ece..5d37eeb57 100644 --- a/plugins/providers/virtualbox/action/check_guest_additions.rb +++ b/plugins/providers/virtualbox/action/check_guest_additions.rb @@ -1,12 +1,20 @@ +require "log4r" + module VagrantPlugins module ProviderVirtualBox module Action class CheckGuestAdditions def initialize(app, env) @app = app + @logger = Log4r::Logger.new("vagrant::plugins::virtualbox::check_guest_additions") end def call(env) + if !env[:machine].provider_config.check_guest_additions + @logger.info("Not checking guest additions because configuration") + return @app.call(env) + end + env[:ui].output(I18n.t("vagrant.virtualbox.checking_guest_additions")) # Use the raw interface for now, while the virtualbox gem diff --git a/plugins/providers/virtualbox/config.rb b/plugins/providers/virtualbox/config.rb index 19140bac3..278b0b840 100644 --- a/plugins/providers/virtualbox/config.rb +++ b/plugins/providers/virtualbox/config.rb @@ -8,6 +8,12 @@ module VagrantPlugins # @return [Boolean] attr_accessor :auto_nat_dns_proxy + # If true, will check if guest additions are installed and up to + # date. By default, this is true. + # + # @return [Boolean] + attr_accessor :check_guest_additions + # An array of customizations to make on the VM prior to booting it. # # @return [Array] @@ -39,6 +45,7 @@ module VagrantPlugins def initialize @auto_nat_dns_proxy = UNSET_VALUE + @check_guest_additions = UNSET_VALUE @customizations = [] @destroy_unused_network_interfaces = UNSET_VALUE @name = UNSET_VALUE @@ -98,6 +105,10 @@ module VagrantPlugins # Default is to auto the DNS proxy @auto_nat_dns_proxy = true if @auto_nat_dns_proxy == UNSET_VALUE + if @check_guest_additions == UNSET_VALUE + @check_guest_additions = true + end + if @destroy_unused_network_interfaces == UNSET_VALUE @destroy_unused_network_interfaces = false end diff --git a/test/unit/plugins/providers/virtualbox/config_test.rb b/test/unit/plugins/providers/virtualbox/config_test.rb index aee442455..0429df31c 100644 --- a/test/unit/plugins/providers/virtualbox/config_test.rb +++ b/test/unit/plugins/providers/virtualbox/config_test.rb @@ -6,6 +6,10 @@ describe VagrantPlugins::ProviderVirtualBox::Config do context "defaults" do before { subject.finalize! } + its(:check_guest_additions) { should be_true } + its(:gui) { should be_false } + its(:name) { should be_nil } + it "should have one NAT adapter" do expect(subject.network_adapters).to eql({ 1 => [:nat, {}],