Proper error handling if the shared folder cannot be created [GH-604]

This commit is contained in:
Mitchell Hashimoto 2012-01-08 11:29:52 -08:00
parent 9cb4597a27
commit 89eb256f9d
3 changed files with 19 additions and 1 deletions

View File

@ -46,7 +46,12 @@ module Vagrant
if !hostpath.directory? && options[:create]
# Host path doesn't exist, so let's create it.
@logger.debug("Host path doesn't exist, creating: #{hostpath}")
hostpath.mkpath
begin
hostpath.mkpath
rescue Errno::EACCES
raise Errors::SharedFolderCreateFailed, :path => hostpath.to_s
end
end
end
end

View File

@ -268,6 +268,11 @@ module Vagrant
error_key(:scp_unavailable)
end
class SharedFolderCreateFailed < VagrantError
status_code(66)
error_key(:shared_folder_create_failed)
end
class SSHAuthenticationFailed < VagrantError
status_code(11)
error_key(:ssh_authentication_failed)

View File

@ -80,6 +80,14 @@ en:
scp_unavailable: |-
SSH server on the guest doesn't support SCP. Please install the necessary
software to enable SCP on your guest operating system.
shared_folder_create_failed: |-
Failed to create the following shared folder on the host system. This is
usually because Vagrant does not have sufficient permissions to create
the folder.
%{path}
Please create the folder manually or specify another path to share.
ssh_authentication_failed: |-
SSH authentication failed! This is typically caused by the public/private
keypair for the SSH user not being properly set on the guest VM. Please