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] source, use that. [GH-3610]
- commands/rsync-auto: Interrupt exits properly. [GH-3552] - commands/rsync-auto: Interrupt exits properly. [GH-3552]
- commands/rsync-auto: Run properly on Windows. [GH-3547] - 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 - providers/virtualbox: VirtalBox detection works properly again on
Windows when the `VBOX_INSTALL_PATH` has multiple elements. [GH-3549] Windows when the `VBOX_INSTALL_PATH` has multiple elements. [GH-3549]
- providers/virtualbox: Forcing MAC address on private network works - providers/virtualbox: Forcing MAC address on private network works

View File

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

View File

@ -78,6 +78,8 @@ module VagrantPlugins
message = "Host appears down." message = "Host appears down."
rescue Vagrant::Errors::SSHNoRoute rescue Vagrant::Errors::SSHNoRoute
message = "Host unreachable." message = "Host unreachable."
rescue Vagrant::Errors::SSHInvalidShell
raise
rescue Vagrant::Errors::SSHKeyTypeNotSupported rescue Vagrant::Errors::SSHKeyTypeNotSupported
raise raise
rescue Vagrant::Errors::VagrantError => e rescue Vagrant::Errors::VagrantError => e
@ -120,6 +122,11 @@ module VagrantPlugins
return false return false
end 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 # If we're already attempting to switch out the SSH key, then
# just return that we're ready (for Machine#guest). # just return that we're ready (for Machine#guest).
@lock.synchronize do @lock.synchronize do

View File

@ -995,6 +995,12 @@ en:
While attempting to connect with SSH, a "host is down" (EHOSTDOWN) While attempting to connect with SSH, a "host is down" (EHOSTDOWN)
error was received. Please verify your SSH settings are correct error was received. Please verify your SSH settings are correct
and try again. 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: |- ssh_is_putty_link: |-
The `ssh` executable found in the PATH is a PuTTY Link SSH client. The `ssh` executable found in the PATH is a PuTTY Link SSH client.
Vagrant is only compatible with OpenSSH SSH clients. Please install Vagrant is only compatible with OpenSSH SSH clients. Please install