core: do proper type conversions for box checksum types

This commit is contained in:
Mitchell Hashimoto 2013-12-01 22:58:25 -08:00
parent f48f2ff072
commit 72edddbb09
3 changed files with 7 additions and 3 deletions

View File

@ -19,8 +19,8 @@ module Vagrant
@download_interrupted = false
# Determine the checksum type to use
checksum = env[:box_checksum] || ""
checksum_klass = case env[:box_checksum_type]
checksum = (env[:box_checksum] || "").to_s
checksum_klass = case env[:box_checksum_type].to_sym
when nil
nil
when :md5

View File

@ -16,7 +16,7 @@ module VagrantPlugins
end
o.on("--checksum-type VALUE", String, "Checksum type") do |c|
options[:checksum_type] = c
options[:checksum_type] = c.to_sym
end
o.on("-c", "--clean", "Remove old temporary download if it exists.") do |c|

View File

@ -270,6 +270,10 @@ module VagrantPlugins
@hostname = nil if @hostname == UNSET_VALUE
@hostname = @hostname.to_s if @hostname
if @box_download_checksum_type
@box_download_checksum_type = @box_download_checksum_type.to_sym
end
# Make sure the box URL is an array if it is set
if @box_url && !@box_url.is_a?(Array)
@box_url = [@box_url]