Merge pull request #8196 from chrisroberts/fix/expand-vagrantfile-path
Allow VAGRANT_DOTFILE_PATH to be expanded as expected.
This commit is contained in:
commit
74438cc495
|
@ -160,8 +160,8 @@ module Vagrant
|
||||||
# it is expanded relative to the root path. Otherwise, we use the
|
# it is expanded relative to the root path. Otherwise, we use the
|
||||||
# default (which is also expanded relative to the root path).
|
# default (which is also expanded relative to the root path).
|
||||||
if !root_path.nil?
|
if !root_path.nil?
|
||||||
if !(ENV["VAGRANT_DOTFILE_PATH"] or "").empty? && !opts[:child]
|
if !ENV["VAGRANT_DOTFILE_PATH"].to_s.empty? && !opts[:child]
|
||||||
opts[:local_data_path] ||= root_path.join(ENV["VAGRANT_DOTFILE_PATH"])
|
opts[:local_data_path] ||= Pathname.new(File.expand_path(ENV["VAGRANT_DOTFILE_PATH"], root_path))
|
||||||
else
|
else
|
||||||
opts[:local_data_path] ||= root_path.join(DEFAULT_LOCAL_DATA)
|
opts[:local_data_path] ||= root_path.join(DEFAULT_LOCAL_DATA)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1030,6 +1030,16 @@ VF
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "with environmental variable VAGRANT_DOTFILE_PATH set with tilde" do
|
||||||
|
it "is set relative to the user's home directory" do
|
||||||
|
with_temp_env("VAGRANT_DOTFILE_PATH" => "~/.vagrant") do
|
||||||
|
instance = env.create_vagrant_env
|
||||||
|
expect(instance.cwd).to eq(env.workdir)
|
||||||
|
expect(instance.local_data_path.to_s).to eq(File.join(Dir.home, ".vagrant"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "upgrading V1 dotfiles" do
|
describe "upgrading V1 dotfiles" do
|
||||||
let(:v1_dotfile_tempfile) do
|
let(:v1_dotfile_tempfile) do
|
||||||
Tempfile.new("vagrant-upgrade-dotfile").tap do |f|
|
Tempfile.new("vagrant-upgrade-dotfile").tap do |f|
|
||||||
|
|
Loading…
Reference in New Issue