guests/linux: more verbose output when shared folder mount fails

[GH-4403]
This commit is contained in:
Mitchell Hashimoto 2014-08-29 08:27:48 -07:00
parent 023ed006bf
commit b42e9aef23
3 changed files with 14 additions and 2 deletions

View File

@ -53,6 +53,8 @@ BUG FIXES:
- guests/fedora: Fix networks on Fedora 20 with libvirt. [GH-4104] - guests/fedora: Fix networks on Fedora 20 with libvirt. [GH-4104]
- guests/freebsd: Rsync install for rsync synced folders work on - guests/freebsd: Rsync install for rsync synced folders work on
FreeBSD 10. [GH-4008] FreeBSD 10. [GH-4008]
- guests/linux: Show more verbose error when shared folder mount fails.
[GH-4403]
- guests/redhat: NFS setup should use systemd for RH7+ [GH-4228] - guests/redhat: NFS setup should use systemd for RH7+ [GH-4228]
- guests/smartos: Use `pfexec` for rsync. [GH-4274] - guests/smartos: Use `pfexec` for rsync. [GH-4274]
- guests/windows: Reboot after hostname change. [GH-3987] - guests/windows: Reboot after hostname change. [GH-3987]

View File

@ -41,10 +41,15 @@ module VagrantPlugins
while true while true
success = true success = true
stderr = ""
mount_commands.each do |command| mount_commands.each do |command|
no_such_device = false no_such_device = false
stderr = ""
status = machine.communicate.sudo(command, error_check: false) do |type, data| status = machine.communicate.sudo(command, error_check: false) do |type, data|
no_such_device = true if type == :stderr && data =~ /No such device/i if type == :stderr
no_such_device = true if data =~ /No such device/i
stderr += data.to_s
end
end end
success = status == 0 && !no_such_device success = status == 0 && !no_such_device
@ -56,7 +61,8 @@ module VagrantPlugins
attempts += 1 attempts += 1
if attempts > 10 if attempts > 10
raise Vagrant::Errors::LinuxMountFailed, raise Vagrant::Errors::LinuxMountFailed,
command: mount_commands.join("\n") command: mount_commands.join("\n"),
output: stderr
end end
sleep 2 sleep 2

View File

@ -750,6 +750,10 @@ en:
can work properly. The command attempted was: can work properly. The command attempted was:
%{command} %{command}
The error output from the last command was:
%{output}
linux_nfs_mount_failed: |- linux_nfs_mount_failed: |-
Mounting NFS shared folders failed. This is most often caused by the NFS Mounting NFS shared folders failed. This is most often caused by the NFS
client software not being installed on the guest machine. Please verify client software not being installed on the guest machine. Please verify