Better validation for networking configuration
This commit is contained in:
parent
c15deb5987
commit
14ca7ecc24
|
@ -4,6 +4,9 @@
|
|||
- Fix chef solo simply not working with roles/data bags. [GH-425]
|
||||
- Multiple chef solo provisioners now work together.
|
||||
- Update Puppet provisioner so no deprecation warning is shown. [GH-421]
|
||||
- Removed error on "provisioner=" in config, as this has not existed
|
||||
for some time now.
|
||||
- Add better validation for networking.
|
||||
|
||||
## 0.8.1 (July 20, 2011)
|
||||
|
||||
|
|
|
@ -67,13 +67,6 @@ module Vagrant
|
|||
@provisioners << Provisioner.new(top, name, options, &block)
|
||||
end
|
||||
|
||||
# This shows an error message to smooth the transition for the
|
||||
# backwards incompatible provisioner syntax change introduced
|
||||
# in Vagrant 0.7.0.
|
||||
def provisioner=(_value)
|
||||
raise Errors::VagrantError, :_key => :provisioner_equals_not_supported
|
||||
end
|
||||
|
||||
def customize(&block)
|
||||
push_proc(&block)
|
||||
end
|
||||
|
@ -126,6 +119,21 @@ module Vagrant
|
|||
end
|
||||
end
|
||||
|
||||
# Validate some basic networking
|
||||
network_options.each do |options|
|
||||
next if !options
|
||||
|
||||
ip = options[:ip].split(".")
|
||||
|
||||
if ip.length != 4
|
||||
errors.add(I18n.t("vagrant.config.vm.network_ip_invalid",
|
||||
:ip => options[:ip]))
|
||||
elsif ip.last == "1"
|
||||
errors.add(I18n.t("vagrant.config.vm.network_ip_ends_one",
|
||||
:ip => options[:ip]))
|
||||
end
|
||||
end
|
||||
|
||||
# Each provisioner can validate itself
|
||||
provisioners.each do |prov|
|
||||
# TODO: Remove at some point
|
||||
|
|
|
@ -48,31 +48,6 @@ en:
|
|||
multi_vm_required: "A multi-vm environment is required for name specification to this command."
|
||||
multi_vm_target_required: "`vagrant %{command}` requires a specific VM name to target in a multi-VM environment."
|
||||
no_env: "No Vagrant environment detected. Run `vagrant init` to set one up."
|
||||
provisioner_equals_not_supported: |-
|
||||
The `config.vm.provisioner =` syntax has been removed in Vagrant 0.7.0.
|
||||
Please change your provisioners to use the new syntax described below.
|
||||
All of these changes are reflected on the Vagrant website as well.
|
||||
|
||||
Before:
|
||||
|
||||
config.vm.provisioner = :chef_solo
|
||||
config.chef.cookbooks_path = "my_cookbooks"
|
||||
config.chef.add_recipe "apache"
|
||||
|
||||
After:
|
||||
|
||||
config.vm.provision :chef_solo, :cookbooks_path => "my_cookbooks",
|
||||
:run_list => ["recipe[apache]"]
|
||||
|
||||
Instead of just a hash, you may use a block as well to get access to the
|
||||
configuration object:
|
||||
|
||||
config.vm.provision :chef_solo do |chef|
|
||||
chef.cookbooks_path = "my_cookbooks"
|
||||
chef.add_recipe "apache"
|
||||
end
|
||||
|
||||
This error message will be removed in later versions of Vagrant.
|
||||
ssh_authentication_failed: |-
|
||||
SSH authentication failed! This is typically caused by the public/private
|
||||
keypair for the SSH user not being properly set on the guest VM. Please
|
||||
|
@ -190,6 +165,10 @@ en:
|
|||
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."
|
||||
network_ip_invalid: "The host only network IP '%{ip}' is invalid."
|
||||
network_ip_ends_one: |-
|
||||
The host only network IP '%{ip}' must not end in a 1, as this
|
||||
is reserved for the host machine.
|
||||
shared_folder_hostpath_missing: "Shared folder host path for '%{name}' doesn't exist: %{path}"
|
||||
shared_folder_nfs_owner_group: |-
|
||||
Shared folder '%{name}': NFS does not support the owner/group settings.
|
||||
|
|
|
@ -53,12 +53,4 @@ class ConfigVMTest < Test::Unit::TestCase
|
|||
assert @config.proc_stack.include?(proc)
|
||||
end
|
||||
end
|
||||
|
||||
context "deprecated config" do
|
||||
should "raise an error for provisioner=" do
|
||||
assert_raises(Vagrant::Errors::VagrantError) {
|
||||
@config.provisioner = :chef_solo
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue