Better box verification/error messages.

This commit is contained in:
Mitchell Hashimoto 2010-10-21 17:58:17 -07:00
parent ef50361f95
commit 6bac0a7ab2
4 changed files with 7 additions and 4 deletions

View File

@ -1,5 +1,6 @@
## 0.6.7 (unreleased)
- Added validation to verify that a box is specified.
- Proper error message when box is not found for `config.vm.box`. [GH-195]
- Fix output of `vagrant status` with multi-vm to be correct. [GH-196]

View File

@ -104,8 +104,10 @@ module Vagrant
end
end
errors.add(I18n.t("vagrant.config.vm.box_missing")) if !box
errors.add(I18n.t("vagrant.config.vm.box_not_found", :name => box)) if box && !box_url && !env.box
errors.add(I18n.t("vagrant.config.vm.boot_mode_invalid")) if ![:vrdp, :gui].include?(boot_mode.to_sym)
errors.add(I18n.t("vagrant.config.vm.base_mac_invalid")) if !base_mac
errors.add(I18n.t("vagrant.config.vm.base_mac_invalid")) if env.box && !base_mac
end
end
end

View File

@ -121,9 +121,7 @@ module Vagrant
#
# @return [Box]
def box
result = boxes.find(config.vm.box)
raise Errors::BoxNotFound, :name => config.vm.box if vm && !result
result
boxes.find(config.vm.box)
end
# Returns the VMs associated with this environment.

View File

@ -115,6 +115,8 @@ en:
vm:
base_mac_invalid: "Base MAC address for eth0/NAT must be set. Contact box maintainer for more information."
boot_mode_invalid: "Boot mode must be one of: vrdp or gui"
box_missing: "A box must be specified."
box_not_found: "The box '%{name}' could not be found."
shared_folder_hostpath_missing: "Shared folder host path for '%{name}' doesn't exist: %{path}"
#-------------------------------------------------------------------------------