diff --git a/lib/vagrant/environment.rb b/lib/vagrant/environment.rb index 100cda0d5..2035feca6 100644 --- a/lib/vagrant/environment.rb +++ b/lib/vagrant/environment.rb @@ -478,32 +478,15 @@ module Vagrant # Finds the Vagrantfile in the given directory. # - # This will raise an error if multiple matching Vagrantfiles are found. - # This can only occur on case sensitive file systems, but if there is a - # `Vagrantfile` and a `vagrantfile` it is not clear which Vagrant will - # load, so an error must be raised. - # # @param [Pathname] path Path to search in. # @return [Pathname] def find_vagrantfile(search_path) - path = nil @vagrantfile_name.each do |vagrantfile| current_path = search_path.join(vagrantfile) - - # If the path exists, then we verify we haven't found a match before, - # then we set the path we've found. - if current_path.exist? - # We also test if current_path == path because on case insensitive - # file systems, it will look like multiple exist. - if path && current_path != path - raise Errors::MultiVagrantfileFound, :directory => search_path.to_s - end - - path = current_path - end + return current_path if current_path.exist? end - path + nil end end end diff --git a/lib/vagrant/errors.rb b/lib/vagrant/errors.rb index 116e3cb42..912a7118a 100644 --- a/lib/vagrant/errors.rb +++ b/lib/vagrant/errors.rb @@ -193,11 +193,6 @@ module Vagrant error_key(:port_collision_resume) end - class MultiVagrantfileFound < VagrantError - status_code(67) - error_key(:multi_vagrantfile_found) - end - class MultiVMEnvironmentRequired < VagrantError status_code(5) error_key(:multi_vm_required) diff --git a/lib/vagrant/util/platform.rb b/lib/vagrant/util/platform.rb index 36df3f804..0ffa214ef 100644 --- a/lib/vagrant/util/platform.rb +++ b/lib/vagrant/util/platform.rb @@ -1,4 +1,5 @@ require 'rbconfig' +require 'tempfile' module Vagrant module Util diff --git a/templates/locales/en.yml b/templates/locales/en.yml index c9c9ccb15..d0e505d8d 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -64,14 +64,8 @@ en: directory that Vagrant uses must be both readable and writable. You specified: %{home_path} - interrupted: "Vagrant exited after cleanup due to external interrupt." - multi_vagrantfile_found: |- - Multiple Vagrantfiles were found in the following directory. This usually - occurs when multiple Vagrantfiles with different casing are found. For - example: Vagrantfile and vagrantfile. Because the behavior in this case - is undefined, please fix it so that there is only one matching Vagrantfile. - - %{directory} + 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: |- diff --git a/test/unit/vagrant/environment_test.rb b/test/unit/vagrant/environment_test.rb index 0d700a344..520500214 100644 --- a/test/unit/vagrant/environment_test.rb +++ b/test/unit/vagrant/environment_test.rb @@ -151,26 +151,6 @@ VF env = environment.create_vagrant_env env.config.for_vm(:default).ssh.port.should == 100 end - - it "should error if the box has an ambiguous Vagrantfile" do - environment = isolated_environment do |env| - env.vagrantfile(<<-VF) -Vagrant::Config.run do |config| - config.vm.box = "base" -end -VF - - # Create two Vagrantfiles. The normal one and a Vagrantfile2 - box_dir = env.box("base", "") - box_dir.join("Vagrantfile2").open("w") do |f| - f.write("") - end - end - - env = environment.create_vagrant_env(:vagrantfile_name => ["Vagrantfile", "Vagrantfile2"]) - expect { env.config }. - to raise_error(Vagrant::Errors::MultiVagrantfileFound) - end end describe "ui" do