Disallow dot and hyphen as first character of hostnames

- Causes hostname to be set to an invalid value on some systems which
  also causes malfunction of hostname -f so it cannot be changed
This commit is contained in:
Sam Gronblom 2013-10-10 14:42:48 +09:00
parent c83ea416ff
commit 9a7ca06cfa
2 changed files with 2 additions and 2 deletions

View File

@ -353,7 +353,7 @@ module VagrantPlugins
errors << I18n.t("vagrant.config.vm.box_not_found", :name => box) if \ errors << I18n.t("vagrant.config.vm.box_not_found", :name => box) if \
box && !box_url && !machine.box box && !box_url && !machine.box
errors << I18n.t("vagrant.config.vm.hostname_invalid_characters") if \ errors << I18n.t("vagrant.config.vm.hostname_invalid_characters") if \
@hostname && @hostname !~ /^[-.a-z0-9]+$/i @hostname && @hostname !~ /^[a-z0-9][-.a-z0-9]+$/i
has_nfs = false has_nfs = false
used_guest_paths = Set.new used_guest_paths = Set.new

View File

@ -691,7 +691,7 @@ en:
box_not_found: "The box '%{name}' could not be found." box_not_found: "The box '%{name}' could not be found."
hostname_invalid_characters: |- hostname_invalid_characters: |-
The hostname set for the VM should only contain letters, numbers, The hostname set for the VM should only contain letters, numbers,
and hyphens. hyphens or dots. It cannot start with a hyphen or dot.
network_invalid: |- network_invalid: |-
The network type '%{type}' is not valid. Please use The network type '%{type}' is not valid. Please use
'hostonly' or 'bridged'. 'hostonly' or 'bridged'.