From 47a368fbfd2b27e69bc866daab80c46c20f4fa3b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 6 Jan 2012 01:08:20 -0800 Subject: [PATCH] VM raises SSHPortNotDetected if ssh_info can't get the port Also, I updated the wording on that error message a bit since it turns out that it is possible through user error that there will be no SSH port. --- lib/vagrant/vm.rb | 4 ++++ templates/locales/en.yml | 13 ++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/vagrant/vm.rb b/lib/vagrant/vm.rb index 7747f9689..cc080ce42 100644 --- a/lib/vagrant/vm.rb +++ b/lib/vagrant/vm.rb @@ -87,6 +87,10 @@ module Vagrant :forward_x11 => config.ssh.forward_x11 } + # This can happen if no port is set and for some reason Vagrant + # can't detect an SSH port. + raise Errors::SSHPortNotDetected if !results[:port] + # Determine the private key path, which is either set by the # configuration or uses just the built-in insecure key. pk_path = config.ssh.private_key_path || env.default_private_key_path diff --git a/templates/locales/en.yml b/templates/locales/en.yml index ece8904ca..cb2c0c3bc 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -109,9 +109,16 @@ en: %{key_path} ssh_port_not_detected: |- - Vagrant couldn't determine the SSH port for your VM! This is a rare, - exceptional event, and a bug should be filed. Please try recreating your - VM (vagrant destroy, then vagrant up). Sorry! + Vagrant couldn't determine the SSH port for your VM! Vagrant attempts to + automatically find a forwarded port that matches your `config.ssh.guest_port` + (default: 22) value and uses this for SSH. Alternatively, if `config.ssh.port` + is set, it will use this. + + However, in this case Vagrant was unable to find a forwarded port that matches + the guest port and `config.ssh.port` is not set! + + Please make sure that you have a forwarded port that goes to the configured + guest port value, or specify an explicit SSH port with `config.ssh.port`. ssh_unavailable: "`ssh` binary could not be found. Is an SSH client installed?" ssh_unavailable_windows: |- `vagrant ssh` isn't available on the Windows platform. The