From b0b18c64ddb5648d78cf34f814f296463f258725 Mon Sep 17 00:00:00 2001 From: Emiliano Ticci Date: Tue, 9 Jul 2013 14:35:07 +0200 Subject: [PATCH] Raise a proper SSH error on EHOSTUNREACH --- lib/vagrant/errors.rb | 4 ++++ plugins/communicators/ssh/communicator.rb | 3 +++ templates/locales/en.yml | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/lib/vagrant/errors.rb b/lib/vagrant/errors.rb index dc24536d3..7f1ce463c 100644 --- a/lib/vagrant/errors.rb +++ b/lib/vagrant/errors.rb @@ -455,6 +455,10 @@ module Vagrant error_key(:ssh_key_type_not_supported) end + class SSHNoRoute < VagrantError + error_key(:ssh_no_route) + end + class SSHNotReady < VagrantError error_key(:ssh_not_ready) end diff --git a/plugins/communicators/ssh/communicator.rb b/plugins/communicators/ssh/communicator.rb index 00c058155..2dea21e33 100644 --- a/plugins/communicators/ssh/communicator.rb +++ b/plugins/communicators/ssh/communicator.rb @@ -235,6 +235,9 @@ module VagrantPlugins rescue Errno::EHOSTDOWN # This is raised if we get an ICMP DestinationUnknown error. raise Vagrant::Errors::SSHHostDown + rescue Errno::EHOSTUNREACH + # This is raised if we can't work out how to route traffic. + raise Vagrant::Errors::SSHNoRoute rescue NotImplementedError # This is raised if a private key type that Net-SSH doesn't support # is used. Show a nicer error. diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 070e2a05f..3f7aa97b2 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -426,6 +426,10 @@ en: usually indicates that SSH within the guest machine was unable to properly start up. Please boot the VM in GUI mode to check whether it is booting properly. + ssh_no_route: |- + While attempting to connect with SSH, a "no route to host" (EHOSTUNREACH) + error was received. Please verify your network settings are correct + and try again. ssh_host_down: |- While attempting to connect with SSH, a "host is down" (EHOSTDOWN) error was received. Please verify your SSH settings are correct