Nicer error messages for new linux caps
This commit is contained in:
parent
2a542dab02
commit
63f28a9011
|
@ -239,6 +239,14 @@ module Vagrant
|
|||
error_key(:guest_not_detected)
|
||||
end
|
||||
|
||||
class LinuxMountFailed < VagrantError
|
||||
error_key(:linux_mount_failed)
|
||||
end
|
||||
|
||||
class LinuxShellExpandFailed < VagrantError
|
||||
error_key(:linux_shell_expand_failed)
|
||||
end
|
||||
|
||||
class LocalDataDirectoryNotAccessible < VagrantError
|
||||
error_key(:local_data_dir_not_accessible)
|
||||
end
|
||||
|
|
|
@ -26,8 +26,7 @@ module VagrantPlugins
|
|||
break if success
|
||||
|
||||
attempts += 1
|
||||
# TODO: Nicer exception
|
||||
raise "Mount failed"
|
||||
raise Vagrant::Errors::LinuxMountFailed, :command => mount_command
|
||||
sleep 2
|
||||
end
|
||||
|
||||
|
|
|
@ -14,8 +14,7 @@ module VagrantPlugins
|
|||
if !real_path
|
||||
# If no real guest path was detected, this is really strange
|
||||
# and we raise an exception because this is a bug.
|
||||
# TODO: Nice exception
|
||||
raise "No expanded guest path detected."
|
||||
raise LinuxShellExpandFailed
|
||||
end
|
||||
|
||||
# Chomp the string so that any trailing newlines are killed
|
||||
|
|
|
@ -8,41 +8,11 @@ module VagrantPlugins
|
|||
class Guest < Vagrant.plugin("2", :guest)
|
||||
include Vagrant::Util::Retryable
|
||||
|
||||
class LinuxError < Vagrant::Errors::VagrantError
|
||||
error_namespace("vagrant.guest.linux")
|
||||
end
|
||||
|
||||
def initialize(*args)
|
||||
super
|
||||
|
||||
@logger = Log4r::Logger.new("vagrant::guest::linux")
|
||||
end
|
||||
|
||||
def detect?(machine)
|
||||
# TODO: Linux detection
|
||||
false
|
||||
end
|
||||
|
||||
def distro_dispatch
|
||||
@vm.communicate.tap do |comm|
|
||||
if comm.test("cat /etc/debian_version")
|
||||
return :debian if comm.test("cat /proc/version | grep 'Debian'")
|
||||
return :ubuntu if comm.test("cat /proc/version | grep 'Ubuntu'")
|
||||
end
|
||||
|
||||
return :gentoo if comm.test("cat /etc/gentoo-release")
|
||||
return :fedora if comm.test("grep 'Fedora release 1[678]' /etc/redhat-release")
|
||||
return :redhat if comm.test("cat /etc/redhat-release")
|
||||
return :suse if comm.test("cat /etc/SuSE-release")
|
||||
return :pld if comm.test("cat /etc/pld-release")
|
||||
return :arch if comm.test("cat /etc/arch-release")
|
||||
return :solaris if comm.test("grep 'Solaris' /etc/release")
|
||||
end
|
||||
|
||||
# Can't detect the distro, assume vanilla linux
|
||||
nil
|
||||
end
|
||||
|
||||
def halt
|
||||
begin
|
||||
@vm.communicate.sudo("shutdown -h now")
|
||||
|
|
|
@ -204,6 +204,18 @@ en:
|
|||
running Vagrant.
|
||||
|
||||
Local data directory: %{local_data_path}
|
||||
linux_mount_failed: |-
|
||||
Failed to mount folders in Linux guest. This is usually beacuse
|
||||
the "vboxsf" file system is not available. Please verify that
|
||||
the guest additions are properly installed in the guest and
|
||||
can work properly. The command attempted was:
|
||||
|
||||
%{command}
|
||||
linux_shell_expand_failed: |-
|
||||
Vagrant failed to determine the shell expansion of the guest path
|
||||
for one of your shared folders. This is an extremely rare error case
|
||||
and most likely indicates an unusual configuration of the guest system.
|
||||
Please report a bug with your Vagrantfile.
|
||||
machine_guest_not_ready: |-
|
||||
Guest-specific operations were attempted on a machine that is not
|
||||
ready for guest communication. This should not happen and a bug
|
||||
|
@ -1066,7 +1078,6 @@ en:
|
|||
for one of your shared folders. This is an extremely rare error case
|
||||
and most likely indicates an unusual configuration of the guest system.
|
||||
Please report a bug with your Vagrantfile.
|
||||
mount_fail: "Failed to mount shared folders. `vboxsf` was not available."
|
||||
mount_nfs_fail: |-
|
||||
Mounting NFS shared folders failed. This is most often caused by the NFS
|
||||
client software not being installed on the guest machine. Please verify
|
||||
|
|
Loading…
Reference in New Issue