Validate forwarded ports

This commit is contained in:
Mitchell Hashimoto 2013-03-01 17:20:31 -08:00
parent 1f2856bdf3
commit c80ad12336
2 changed files with 13 additions and 0 deletions

View File

@ -245,6 +245,17 @@ module VagrantPlugins
end end
end end
# Validate networks
has_fp_port_error = false
networks.each do |type, options|
if type == :forwarded_port
if !has_fp_port_error && (!options[:guest] || !options[:host])
errors << I18n.t("vagrant.config.vm.network_fp_requires_ports")
has_fp_port_error = true
end
end
end
# We're done with VM level errors so prepare the section # We're done with VM level errors so prepare the section
errors = { "vm" => errors } errors = { "vm" => errors }

View File

@ -444,6 +444,8 @@ en:
nfs_requires_host: |- nfs_requires_host: |-
Using NFS shared folders requires a host to be specified Using NFS shared folders requires a host to be specified
using `config.vagrant.host`. using `config.vagrant.host`.
network_fp_requires_ports: |-
Forwarded port definitions require a "host" and "guest" value
shared_folder_hostpath_missing: |- shared_folder_hostpath_missing: |-
The host path of the shared folder is missing: %{path} The host path of the shared folder is missing: %{path}
shared_folder_nfs_owner_group: |- shared_folder_nfs_owner_group: |-