Revert the check for duplicate Vagrantfiles.
This is just tricky with case sensitive/insensitive file systems. Reverting since it doesn't seem worth it.
This commit is contained in:
parent
4f30a834d0
commit
ef37f692bd
|
@ -478,32 +478,15 @@ module Vagrant
|
||||||
|
|
||||||
# Finds the Vagrantfile in the given directory.
|
# 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.
|
# @param [Pathname] path Path to search in.
|
||||||
# @return [Pathname]
|
# @return [Pathname]
|
||||||
def find_vagrantfile(search_path)
|
def find_vagrantfile(search_path)
|
||||||
path = nil
|
|
||||||
@vagrantfile_name.each do |vagrantfile|
|
@vagrantfile_name.each do |vagrantfile|
|
||||||
current_path = search_path.join(vagrantfile)
|
current_path = search_path.join(vagrantfile)
|
||||||
|
return current_path if current_path.exist?
|
||||||
# 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
|
end
|
||||||
|
|
||||||
path = current_path
|
nil
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
path
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -193,11 +193,6 @@ module Vagrant
|
||||||
error_key(:port_collision_resume)
|
error_key(:port_collision_resume)
|
||||||
end
|
end
|
||||||
|
|
||||||
class MultiVagrantfileFound < VagrantError
|
|
||||||
status_code(67)
|
|
||||||
error_key(:multi_vagrantfile_found)
|
|
||||||
end
|
|
||||||
|
|
||||||
class MultiVMEnvironmentRequired < VagrantError
|
class MultiVMEnvironmentRequired < VagrantError
|
||||||
status_code(5)
|
status_code(5)
|
||||||
error_key(:multi_vm_required)
|
error_key(:multi_vm_required)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
require 'rbconfig'
|
require 'rbconfig'
|
||||||
|
require 'tempfile'
|
||||||
|
|
||||||
module Vagrant
|
module Vagrant
|
||||||
module Util
|
module Util
|
||||||
|
|
|
@ -64,14 +64,8 @@ en:
|
||||||
directory that Vagrant uses must be both readable and writable.
|
directory that Vagrant uses must be both readable and writable.
|
||||||
|
|
||||||
You specified: %{home_path}
|
You specified: %{home_path}
|
||||||
interrupted: "Vagrant exited after cleanup due to external interrupt."
|
interrupted: |-
|
||||||
multi_vagrantfile_found: |-
|
Vagrant exited after cleanup due to external interrupt.
|
||||||
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}
|
|
||||||
multi_vm_required: |-
|
multi_vm_required: |-
|
||||||
A multi-vm environment is required for name specification to this command.
|
A multi-vm environment is required for name specification to this command.
|
||||||
multi_vm_target_required: |-
|
multi_vm_target_required: |-
|
||||||
|
|
|
@ -151,26 +151,6 @@ VF
|
||||||
env = environment.create_vagrant_env
|
env = environment.create_vagrant_env
|
||||||
env.config.for_vm(:default).ssh.port.should == 100
|
env.config.for_vm(:default).ssh.port.should == 100
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
describe "ui" do
|
describe "ui" do
|
||||||
|
|
Loading…
Reference in New Issue