communicators/ssh: detect if config.ssh.shell is non-functional [GH-3040]

This commit is contained in:
Mitchell Hashimoto 2014-05-01 21:35:02 -07:00
parent 8db5e820dd
commit 604ae6caa3
4 changed files with 18 additions and 0 deletions

View File

@ -71,6 +71,7 @@ BUG FIXES:
source, use that. [GH-3610]
- commands/rsync-auto: Interrupt exits properly. [GH-3552]
- commands/rsync-auto: Run properly on Windows. [GH-3547]
- communicators/ssh: Detect if `config.ssh.shell` is invalid. [GH-3040]
- providers/virtualbox: VirtalBox detection works properly again on
Windows when the `VBOX_INSTALL_PATH` has multiple elements. [GH-3549]
- providers/virtualbox: Forcing MAC address on private network works

View File

@ -592,6 +592,10 @@ module Vagrant
error_key(:ssh_host_down)
end
class SSHInvalidShell< VagrantError
error_key(:ssh_invalid_shell)
end
class SSHIsPuttyLink < VagrantError
error_key(:ssh_is_putty_link)
end

View File

@ -78,6 +78,8 @@ module VagrantPlugins
message = "Host appears down."
rescue Vagrant::Errors::SSHNoRoute
message = "Host unreachable."
rescue Vagrant::Errors::SSHInvalidShell
raise
rescue Vagrant::Errors::SSHKeyTypeNotSupported
raise
rescue Vagrant::Errors::VagrantError => e
@ -120,6 +122,11 @@ module VagrantPlugins
return false
end
# Verify the shell is valid
if execute("", error_check: false) != 0
raise Vagrant::Errors::SSHInvalidShell
end
# If we're already attempting to switch out the SSH key, then
# just return that we're ready (for Machine#guest).
@lock.synchronize do

View File

@ -995,6 +995,12 @@ en:
While attempting to connect with SSH, a "host is down" (EHOSTDOWN)
error was received. Please verify your SSH settings are correct
and try again.
ssh_invalid_shell: |-
The configured shell (config.ssh.shell) is invalid and unable
to properly execute commands. The most common cause for this is
using a shell that is unavailable on the system. Please verify
you're using the full path to the shell and that the shell is
executable by the SSH user.
ssh_is_putty_link: |-
The `ssh` executable found in the PATH is a PuTTY Link SSH client.
Vagrant is only compatible with OpenSSH SSH clients. Please install