Special error message if SCP is unavailable [GH-568]

This commit is contained in:
Mitchell Hashimoto 2011-12-10 21:29:11 -08:00
parent 98448d5557
commit f44f1831ef
4 changed files with 15 additions and 0 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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).

View File

@ -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