Merge pull request #7483 from mitchellh/sethvargo/global_box_update_disable
core: Provide a way to globally disable box update checking
This commit is contained in:
commit
8561a12f61
|
@ -5,6 +5,7 @@ require "set"
|
|||
require "vagrant"
|
||||
require "vagrant/config/v2/util"
|
||||
require "vagrant/util/platform"
|
||||
require "vagrant/util/presence"
|
||||
|
||||
require File.expand_path("../vm_provisioner", __FILE__)
|
||||
require File.expand_path("../vm_subvm", __FILE__)
|
||||
|
@ -12,6 +13,8 @@ require File.expand_path("../vm_subvm", __FILE__)
|
|||
module VagrantPlugins
|
||||
module Kernel_V2
|
||||
class VMConfig < Vagrant.plugin("2", :config)
|
||||
include Vagrant::Util::Presence
|
||||
|
||||
DEFAULT_VM_NAME = :default
|
||||
|
||||
attr_accessor :allowed_synced_folder_types
|
||||
|
@ -361,7 +364,11 @@ module VagrantPlugins
|
|||
@base_mac = nil if @base_mac == UNSET_VALUE
|
||||
@boot_timeout = 300 if @boot_timeout == UNSET_VALUE
|
||||
@box = nil if @box == UNSET_VALUE
|
||||
@box_check_update = true if @box_check_update == UNSET_VALUE
|
||||
|
||||
if @box_check_update == UNSET_VALUE
|
||||
@box_check_update = !present?(ENV["VAGRANT_BOX_UPDATE_CHECK_DISABLE"])
|
||||
end
|
||||
|
||||
@box_download_ca_cert = nil if @box_download_ca_cert == UNSET_VALUE
|
||||
@box_download_ca_path = nil if @box_download_ca_path == UNSET_VALUE
|
||||
@box_download_checksum = nil if @box_download_checksum == UNSET_VALUE
|
||||
|
|
|
@ -75,9 +75,17 @@ describe VagrantPlugins::Kernel_V2::VMConfig do
|
|||
|
||||
context "#box_check_update" do
|
||||
it "defaults to true" do
|
||||
with_temp_env("VAGRANT_BOX_UPDATE_CHECK_DISABLE" => "") do
|
||||
subject.finalize!
|
||||
expect(subject.box_check_update).to be(true)
|
||||
end
|
||||
end
|
||||
|
||||
expect(subject.box_check_update).to be_true
|
||||
it "is false if VAGRANT_BOX_UPDATE_CHECK_DISABLE is set" do
|
||||
with_temp_env("VAGRANT_BOX_UPDATE_CHECK_DISABLE" => "1") do
|
||||
subject.finalize!
|
||||
expect(subject.box_check_update).to be(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -32,6 +32,16 @@ Vagrant to use this provider for any _new_ Vagrant environments. Existing
|
|||
Vagrant environments will continue to use the provider they came `up` with.
|
||||
Once you `vagrant destroy` existing environments, this will take effect.
|
||||
|
||||
## `VAGRANT_BOX_UPDATE_CHECK_DISABLE`
|
||||
|
||||
By default, Vagrant will query the metadata API server to see if a newer
|
||||
box version is available for download. This optional can be disabled on a
|
||||
per-Vagrantfile basis with `config.vm.box_check_update`, but it can also be
|
||||
disabled globally setting `VAGRANT_BOX_UPDATE_CHECK_DISABLE` to any non-empty
|
||||
value.
|
||||
|
||||
This option will not affect global box functions like `vagrant box update`.
|
||||
|
||||
## `VAGRANT_CHECKPOINT_DISABLE`
|
||||
|
||||
Vagrant does occasional network calls to check whether the version of Vagrant
|
||||
|
|
Loading…
Reference in New Issue