SSHAuthenticationFailed error

This commit is contained in:
Mitchell Hashimoto 2010-08-27 00:01:27 -07:00
parent 500a63c269
commit bab369e856
5 changed files with 12 additions and 18 deletions

View File

@ -56,6 +56,11 @@ module Vagrant
error_key(:no_env)
end
class SSHAuthenticationFailed < VagrantError
status_code(11)
error_key(:ssh_authentication_failed)
end
class SSHUnavailableWindows < VagrantError
status_code(10)
error_key(:ssh_unavailable_windows)

View File

@ -105,7 +105,7 @@ module Vagrant
check_thread.join(env.config.ssh.timeout)
return check_thread[:result]
rescue Net::SSH::AuthenticationFailed
error_and_exit(:vm_ssh_auth_failed)
raise Errors::SSHAuthenticationFailed.new
end
# Checks the file permissions for the private key, resetting them

View File

@ -11,6 +11,11 @@ en:
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.
no_env: No Vagrant environment detected. Run `vagrant init` to set one up.
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
verify that the guest VM is setup with the proper public key, and that
the private key path for Vagrant is setup propery as well.
ssh_unavailable_windows: |-
`vagrant ssh` isn't available on the Windows platform. The
vagrant.ppk file for use with Putty is available at:

View File

@ -200,21 +200,6 @@
The vagrant virtual environment you are trying to package must be powered off.
:vm_mount_fail: |-
Failed to mount shared folders. vboxsf was not available.
:vm_ssh_auth_failed: |-
SSH authentication failed! While this could be due to a variety of reasons,
the two most common are: private key path is incorrect or you're using a box
which was built for Vagrant 0.1.x.
Vagrant 0.2.x dropped support for password-based authentication. If you're
tring to `vagrant up` a box which does not support Vagrant's private/public
keypair, then this error will be raised. To resolve this, read the guide
on converting base boxes from password-based to keypairs here:
http://vagrantup.com/docs/converting_password_to_key_ssh.html
If the box was built for 0.2.x and contains a custom public key, perhaps
the path to the private key is incorrect. Check your `config.ssh.private_key_path`.
#---------------------------------------------------------------------
# CATEGORY: Error Messages for Linux System
#---------------------------------------------------------------------

View File

@ -229,8 +229,7 @@ class SshTest < Test::Unit::TestCase
should "error and exit if a Net::SSH::AuthenticationFailed is raised" do
@ssh.expects(:execute).raises(Net::SSH::AuthenticationFailed)
@ssh.expects(:error_and_exit).with(:vm_ssh_auth_failed).once
@ssh.up?
assert_raises(Vagrant::Errors::SSHAuthenticationFailed) { @ssh.up? }
end
end