Check for permission denied when using SCP to upload [GH-924]
This commit is contained in:
parent
76f7da0618
commit
fa99eb7e54
|
@ -34,6 +34,8 @@
|
|||
process to 100%. [GH-832]
|
||||
- Fix issue where shell provisioner would sometimes never end. [GH-968]
|
||||
- FIx issue where puppet would reorder module paths. [GH-964]
|
||||
- Human-friendly error is raised if there are permission issues when
|
||||
using SCP to upload files. [GH-924]
|
||||
|
||||
## 1.0.3 (May 1, 2012)
|
||||
|
||||
|
|
|
@ -85,6 +85,15 @@ module Vagrant
|
|||
scp_connect do |scp|
|
||||
scp.upload!(from, to)
|
||||
end
|
||||
rescue RuntimeError => e
|
||||
# Net::SCP raises a runtime error for this so the only way we have
|
||||
# to really catch this exception is to check the message to see if
|
||||
# it is something we care about. If it isn't, we re-raise.
|
||||
raise if e.message !~ /Permission denied/
|
||||
|
||||
# Otherwise, it is a permission denied, so let's raise a proper
|
||||
# exception
|
||||
raise Errors::SCPPermissionDenied, :path => from
|
||||
end
|
||||
|
||||
protected
|
||||
|
|
|
@ -303,6 +303,11 @@ module Vagrant
|
|||
error_key(:plugin_load_error)
|
||||
end
|
||||
|
||||
class SCPPermissionDenied < VagrantError
|
||||
status_code(82)
|
||||
error_key(:scp_permission_denied)
|
||||
end
|
||||
|
||||
class SCPUnavailable < VagrantError
|
||||
status_code(56)
|
||||
error_key(:scp_unavailable)
|
||||
|
|
|
@ -92,6 +92,12 @@ en:
|
|||
for you but VirtualBox only allows forwarded ports to change if the VM is
|
||||
powered off. Therefore, please reload your VM or halt the other running
|
||||
VMs to continue.
|
||||
scp_permission_denied: |-
|
||||
Failed to upload a file to the guest VM via SCP due to a permissions
|
||||
error. This is normally because the user running Vagrant doesn't have
|
||||
read permission on the file. Please set proper permissions on the file:
|
||||
|
||||
%{path}
|
||||
scp_unavailable: |-
|
||||
SSH server on the guest doesn't support SCP. Please install the necessary
|
||||
software to enable SCP on your guest operating system.
|
||||
|
|
Loading…
Reference in New Issue