Show an error if an invalid network type is used

This commit is contained in:
Mitchell Hashimoto 2013-04-02 15:00:18 -07:00
parent bc2a9fe780
commit a8a7a7865d
3 changed files with 9 additions and 0 deletions

View File

@ -24,6 +24,7 @@ BUG FIXES:
status 126). [GH-934]
- Action hook prepend/append will only prepend or append once.
- Retry SSH on Errno::EACCES.
- Show an error if an invalid network type is used.
## 1.1.4 (March 25, 2013)

View File

@ -297,8 +297,14 @@ module VagrantPlugins
# Validate networks
has_fp_port_error = false
fp_host_ports = Set.new
valid_network_types = [:forwarded_port, :private_network, :public_network]
networks.each do |type, options|
if !valid_network_types.include?(type)
errors << I18n.t("vagrant.config.vm.network_type_invalid",
:type => type.to_s)
end
if type == :forwarded_port
if !has_fp_port_error && (!options[:guest] || !options[:host])
errors << I18n.t("vagrant.config.vm.network_fp_requires_ports")

View File

@ -494,6 +494,8 @@ en:
Forwarded port '%{host}' (host port) is declared multiple times
network_fp_requires_ports: |-
Forwarded port definitions require a "host" and "guest" value
network_type_invalid: |-
Network type '%{type}' is invalid. Please use a valid network type.
provisioner_not_found: |-
The '%{name}' provisioner could not be found.
shared_folder_guestpath_duplicate: |-