From 72edddbb0957c64140e8d70a0d0058ee4b2109e3 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 1 Dec 2013 22:58:25 -0800 Subject: [PATCH] core: do proper type conversions for box checksum types --- lib/vagrant/action/builtin/box_add.rb | 4 ++-- plugins/commands/box/command/add.rb | 2 +- plugins/kernel_v2/config/vm.rb | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/vagrant/action/builtin/box_add.rb b/lib/vagrant/action/builtin/box_add.rb index b362a1c6e..45a9bfc89 100644 --- a/lib/vagrant/action/builtin/box_add.rb +++ b/lib/vagrant/action/builtin/box_add.rb @@ -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 diff --git a/plugins/commands/box/command/add.rb b/plugins/commands/box/command/add.rb index 3af9fb82e..f53283704 100644 --- a/plugins/commands/box/command/add.rb +++ b/plugins/commands/box/command/add.rb @@ -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| diff --git a/plugins/kernel_v2/config/vm.rb b/plugins/kernel_v2/config/vm.rb index 3de26a12b..f1ee63dde 100644 --- a/plugins/kernel_v2/config/vm.rb +++ b/plugins/kernel_v2/config/vm.rb @@ -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]