diff --git a/CHANGELOG.md b/CHANGELOG.md index edc335e72..f07788846 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Linux uses `shutdown -h` instead of `halt` to hopefully more consistently power off the system. [GH-575] - Tweaks to SSH to hopefully be more reliable in coming up. + - Helpful error message when SCP is unavailable in the guest. [GH-568] ## 0.8.10 (December 10, 2011) diff --git a/lib/vagrant/errors.rb b/lib/vagrant/errors.rb index a29d9dbe6..1a9b12170 100644 --- a/lib/vagrant/errors.rb +++ b/lib/vagrant/errors.rb @@ -245,6 +245,11 @@ module Vagrant error_key(:dotfile_error, "vagrant.actions.vm.persist") end + class SCPUnavailable < VagrantError + status_code(56) + error_key(:scp_unavailable) + end + class SSHAuthenticationFailed < VagrantError status_code(11) error_key(:ssh_authentication_failed) diff --git a/lib/vagrant/ssh.rb b/lib/vagrant/ssh.rb index 8cd92f2d5..025f98390 100644 --- a/lib/vagrant/ssh.rb +++ b/lib/vagrant/ssh.rb @@ -104,6 +104,12 @@ module Vagrant scp.upload!(from, to) end end + rescue Net::SCP::Error + # If we get the exit code of 127, then this means SCP is unavailable. + raise Errors::SCPUnavailable if e.message =~ /\(127\)/ + + # Otherwise, just raise the error up + raise end # Checks if this environment's machine is up (i.e. responding to SSH). diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 3f5cabe39..c4c432632 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -52,6 +52,9 @@ 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." + scp_unavailable: |- + SSH server on the guest doesn't support SCP. Please install the necessary + software to enable SCP on your guest operating system. 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