diff --git a/lib/vagrant/config/vm.rb b/lib/vagrant/config/vm.rb index 5489a9dbd..349a25eeb 100644 --- a/lib/vagrant/config/vm.rb +++ b/lib/vagrant/config/vm.rb @@ -64,6 +64,13 @@ module Vagrant @provisioners << Provisioner.new(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 shared_folder_uid @shared_folder_uid || env.config.ssh.username end diff --git a/templates/locales/en.yml b/templates/locales/en.yml index e2c1b55fa..2da5a74c5 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -31,10 +31,35 @@ en: this command in another directory. If you aren't in a home directory, then please rename ".vagrant" to something else, or configure Vagrant to use another filename by modifying `config.vagrant.dotfile_name`. - interrupted: Vagrant exited after cleanup due to external interrupt. - 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. + interrupted: "Vagrant exited after cleanup due to external interrupt." + 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 diff --git a/test/vagrant/config/vm_test.rb b/test/vagrant/config/vm_test.rb index 0033ae4e1..4106ab5b6 100644 --- a/test/vagrant/config/vm_test.rb +++ b/test/vagrant/config/vm_test.rb @@ -75,4 +75,12 @@ class ConfigVMTest < Test::Unit::TestCase assert_equal @username, @config.shared_folder_gid 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