kernel/v2: support checksum on box config

This commit is contained in:
Mitchell Hashimoto 2013-12-01 22:45:08 -08:00
parent 84ea952df3
commit 555f4c7dcf
3 changed files with 25 additions and 1 deletions

View File

@ -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,

View File

@ -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|

View File

@ -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: |-