Validate the hostname setting

This commit is contained in:
Mitchell Hashimoto 2013-03-09 10:07:55 -08:00
parent ad0e6deb3e
commit 98a9b47567
2 changed files with 5 additions and 0 deletions

View File

@ -243,6 +243,8 @@ module VagrantPlugins
errors << I18n.t("vagrant.config.vm.box_missing") if !box
errors << I18n.t("vagrant.config.vm.box_not_found", :name => box) if \
box && !box_url && !machine.box
errors << I18n.t("vagrant.config.vm.hostname_invalid_characters") if \
@hostname && @hostname !~ /^[-.a-z0-9]+$/i
has_nfs = false
@synced_folders.each do |id, options|

View File

@ -425,6 +425,9 @@ en:
base_mac_invalid: "Base MAC address for eth0/NAT must be set. Contact box maintainer for more information."
box_missing: "A box must be specified."
box_not_found: "The box '%{name}' could not be found."
hostname_invalid_characters: |-
The hostname set for the VM should only contain letters, numbers,
and hyphens.
network_invalid: |-
The network type '%{type}' is not valid. Please use
'hostonly' or 'bridged'.