Properly handle exception raised when property does not exist

This commit is contained in:
Chris Roberts 2017-06-19 14:04:57 -07:00
parent 09d9c7563a
commit c5b3751a83
2 changed files with 12 additions and 4 deletions

View File

@ -609,10 +609,14 @@ module VagrantPlugins
end
def share_folders(folders)
guestOS = read_guest_property("/VirtualBox/GuestInfo/OS/Product")
is_solaris = begin
"SunOS" == read_guest_property("/VirtualBox/GuestInfo/OS/Product")
rescue
false
end
folders.each do |folder|
hostpath = folder[:hostpath]
if Vagrant::Util::Platform.windows? && guestOS != "SunOS"
if Vagrant::Util::Platform.windows? && is_solaris
hostpath = Vagrant::Util::Platform.windows_unc_path(hostpath)
end
args = ["--name",

View File

@ -613,11 +613,15 @@ module VagrantPlugins
end
def share_folders(folders)
guestOS = read_guest_property("/VirtualBox/GuestInfo/OS/Product")
is_solaris = begin
"SunOS" == read_guest_property("/VirtualBox/GuestInfo/OS/Product")
rescue
false
end
folders.each do |folder|
# NOTE: Guest additions on Solaris guests do not properly handle
# UNC style paths so prevent conversion (See GH-7264)
if guestOS == "SunOS"
if is_solaris
hostpath = folder[:hostpath]
else
hostpath = Vagrant::Util::Platform.windows_path(folder[:hostpath])