diff --git a/lib/vagrant/action/builtin/handle_box_url.rb b/lib/vagrant/action/builtin/handle_box_url.rb index eed8f307d..6a71be6a5 100644 --- a/lib/vagrant/action/builtin/handle_box_url.rb +++ b/lib/vagrant/action/builtin/handle_box_url.rb @@ -41,6 +41,8 @@ module Vagrant box_name = env[:machine].config.vm.box box_url = env[:machine].config.vm.box_url box_download_ca_cert = env[:machine].config.vm.box_download_ca_cert + box_download_checksum = env[:machine].config.vm.box_download_checksum + box_download_checksum_type = env[:machine].config.vm.box_download_checksum_type box_download_client_cert = env[:machine].config.vm.box_download_client_cert box_download_insecure = env[:machine].config.vm.box_download_insecure @@ -69,8 +71,10 @@ module Vagrant begin env[:action_runner].run(Vagrant::Action.action_box_add, { - :box_download_ca_cert => box_download_ca_cert, + :box_checksum => box_download_checksum, + :box_checksum_type => box_download_checksum_type, :box_client_cert => box_download_client_cert, + :box_download_ca_cert => box_download_ca_cert, :box_download_insecure => box_download_insecure, :box_name => box_name, :box_provider => box_formats, diff --git a/plugins/kernel_v2/config/vm.rb b/plugins/kernel_v2/config/vm.rb index 191e7a3d1..3de26a12b 100644 --- a/plugins/kernel_v2/config/vm.rb +++ b/plugins/kernel_v2/config/vm.rb @@ -19,6 +19,8 @@ module VagrantPlugins attr_accessor :box attr_accessor :box_url attr_accessor :box_download_ca_cert + attr_accessor :box_download_checksum + attr_accessor :box_download_checksum_type attr_accessor :box_download_client_cert attr_accessor :box_download_insecure attr_accessor :graceful_halt_timeout @@ -30,6 +32,8 @@ module VagrantPlugins def initialize @boot_timeout = UNSET_VALUE @box_download_ca_cert = UNSET_VALUE + @box_download_checksum = UNSET_VALUE + @box_download_checksum_type = UNSET_VALUE @box_download_client_cert = UNSET_VALUE @box_download_insecure = UNSET_VALUE @box_url = UNSET_VALUE @@ -256,6 +260,8 @@ module VagrantPlugins # Defaults @boot_timeout = 300 if @boot_timeout == UNSET_VALUE @box_download_ca_cert = nil if @box_download_ca_cert == UNSET_VALUE + @box_download_checksum = nil if @box_download_checksum == UNSET_VALUE + @box_download_checksum_type = nil if @box_download_checksum_type == UNSET_VALUE @box_download_client_cert = nil if @box_download_client_cert == UNSET_VALUE @box_download_insecure = false if @box_download_insecure == UNSET_VALUE @box_url = nil if @box_url == UNSET_VALUE @@ -385,6 +391,16 @@ module VagrantPlugins end end + if box_download_checksum_type + if box_download_checksum == "" + errors << I18n.t("vagrant.config.vm.box_download_checksum_blank") + end + else + if box_download_checksum != "" + errors << I18n.t("vagrant.config.vm.box_download_checksum_notblank") + end + end + has_nfs = false used_guest_paths = Set.new @__synced_folders.each do |id, options| diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 582cd91a4..cfbdffdec 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -734,6 +734,10 @@ en: base_mac_invalid: "Base MAC address for eth0/NAT must be set. Contact box maintainer for more information." box_download_ca_cert_not_found: |- "box_download_ca_cert" file not found: %{path} + box_download_checksum_blank: |- + Checksum type specified but "box_download_checksum" is blank + box_download_checksum_notblank: |- + Checksum specified but must also specify "box_download_checksum_type" box_missing: "A box must be specified." box_not_found: "The box '%{name}' could not be found." hostname_invalid_characters: |-