Nice error message given if ".vagrant" is a directory and therefore can't be accessed. [closes GH-172]
This commit is contained in:
parent
9f5641fd84
commit
e36a9d3a0c
|
@ -1,5 +1,7 @@
|
|||
## 0.6.5 (unreleased)
|
||||
|
||||
- A nice error message is given if ".vagrant" is a directory and therefore
|
||||
can't be accessed. [GH-172]
|
||||
- Fix plugin loading in a Rails 2.3.x project. [GH-176]
|
||||
|
||||
## 0.6.4 (October 4, 2010)
|
||||
|
|
|
@ -24,6 +24,8 @@ module Vagrant
|
|||
end
|
||||
rescue Errno::ENOENT
|
||||
clear
|
||||
rescue Errno::EISDIR
|
||||
raise Errors::DotfileIsDirectory
|
||||
end
|
||||
|
||||
# Commits any changes to the data to disk. Even if the data
|
||||
|
|
|
@ -133,6 +133,11 @@ module Vagrant
|
|||
error_key(:config_validation)
|
||||
end
|
||||
|
||||
class DotfileIsDirectory < VagrantError
|
||||
status_code(46)
|
||||
error_key(:dotfile_is_directory)
|
||||
end
|
||||
|
||||
class DownloaderFileDoesntExist < VagrantError
|
||||
status_code(37)
|
||||
error_key(:file_missing, "vagrant.downloaders.file")
|
||||
|
|
|
@ -15,6 +15,12 @@ en:
|
|||
are printed below:
|
||||
|
||||
%{messages}
|
||||
dotfile_is_directory: |-
|
||||
The local file Vagrant uses to store data ".vagrant" already exists
|
||||
and is a directory! If you are in your home directory, then please run
|
||||
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.
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
require "fileutils"
|
||||
require "test_helper"
|
||||
|
||||
class DataStoreTest < Test::Unit::TestCase
|
||||
|
@ -11,7 +12,15 @@ class DataStoreTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
teardown do
|
||||
File.delete(@db_file) if File.file?(@db_file)
|
||||
File.delete(@db_file) if File.exist?(@db_file)
|
||||
end
|
||||
|
||||
should "raise an exception if the db file is a directory" do
|
||||
file = tmp_path.join("data_store_folder_test")
|
||||
FileUtils.mkdir_p(file)
|
||||
assert_raises (Vagrant::Errors::DotfileIsDirectory) {
|
||||
@klass.new(file)
|
||||
}
|
||||
end
|
||||
|
||||
should "be a hash with indifferent access" do
|
||||
|
|
Loading…
Reference in New Issue