Merge pull request #6542 from mitchellh/b-dotfile
core: don't make dotfile path if no Vagrantfile
This commit is contained in:
commit
be29915bed
|
@ -832,7 +832,7 @@ module Vagrant
|
||||||
|
|
||||||
# This creates the local data directory and show an error if it
|
# This creates the local data directory and show an error if it
|
||||||
# couldn't properly be created.
|
# couldn't properly be created.
|
||||||
def setup_local_data_path
|
def setup_local_data_path(force=false)
|
||||||
if @local_data_path.nil?
|
if @local_data_path.nil?
|
||||||
@logger.warn("No local data path is set. Local data cannot be stored.")
|
@logger.warn("No local data path is set. Local data cannot be stored.")
|
||||||
return
|
return
|
||||||
|
@ -847,6 +847,9 @@ module Vagrant
|
||||||
upgrade_v1_dotfile(@local_data_path)
|
upgrade_v1_dotfile(@local_data_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# If we don't have a root path, we don't setup anything
|
||||||
|
return if !force && root_path.nil?
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@logger.debug("Creating: #{@local_data_path}")
|
@logger.debug("Creating: #{@local_data_path}")
|
||||||
FileUtils.mkdir_p(@local_data_path)
|
FileUtils.mkdir_p(@local_data_path)
|
||||||
|
@ -965,7 +968,7 @@ module Vagrant
|
||||||
|
|
||||||
# Now, we create the actual local data directory. This should succeed
|
# Now, we create the actual local data directory. This should succeed
|
||||||
# this time since we renamed the old conflicting V1.
|
# this time since we renamed the old conflicting V1.
|
||||||
setup_local_data_path
|
setup_local_data_path(true)
|
||||||
|
|
||||||
if json_data["active"]
|
if json_data["active"]
|
||||||
@logger.debug("Upgrading to V2 style for each active VM")
|
@logger.debug("Upgrading to V2 style for each active VM")
|
||||||
|
|
|
@ -905,8 +905,13 @@ VF
|
||||||
end
|
end
|
||||||
|
|
||||||
it "is expanded relative to the cwd" do
|
it "is expanded relative to the cwd" do
|
||||||
instance = described_class.new(local_data_path: "foo")
|
Dir.mktmpdir do |temp_dir|
|
||||||
expect(instance.local_data_path).to eq(instance.cwd.join("foo"))
|
Dir.chdir(temp_dir) do
|
||||||
|
instance = described_class.new(local_data_path: "foo")
|
||||||
|
expect(instance.local_data_path).to eq(instance.cwd.join("foo"))
|
||||||
|
expect(File.exist?(instance.local_data_path)).to be_false
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "is set to the given value" do
|
it "is set to the given value" do
|
||||||
|
@ -933,7 +938,7 @@ VF
|
||||||
end
|
end
|
||||||
|
|
||||||
expect { instance }.to_not raise_error
|
expect { instance }.to_not raise_error
|
||||||
expect(Pathname.new(local_data_path)).to be_directory
|
expect(Pathname.new(local_data_path)).to_not be_exist
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should upgrade all active VMs" do
|
it "should upgrade all active VMs" do
|
||||||
|
|
Loading…
Reference in New Issue