More effective guest addition version check [GH-639]

This commit is contained in:
Mitchell Hashimoto 2012-01-13 16:13:41 -08:00
parent ecaf083806
commit 0ee501fb6b
2 changed files with 16 additions and 2 deletions

View File

@ -231,7 +231,14 @@ module Vagrant
def read_guest_additions_version
output = execute("guestproperty", "get", @uuid, "/VirtualBox/GuestAdd/Version")
return $1.to_s if output =~ /^Value: (.+?)$/
if output =~ /^Value: (.+?)$/
# Split the version by _ since some distro versions modify it
# to look like this: 4.1.2_ubuntu, and the distro part isn't
# too important.
value = $1.to_s
return value.split("_").first
end
return nil
end

View File

@ -231,7 +231,14 @@ module Vagrant
def read_guest_additions_version
output = execute("guestproperty", "get", @uuid, "/VirtualBox/GuestAdd/Version")
return $1.to_s if output =~ /^Value: (.+?)$/
if output =~ /^Value: (.+?)$/
# Split the version by _ since some distro versions modify it
# to look like this: 4.1.2_ubuntu, and the distro part isn't
# too important.
value = $1.to_s
return value.split("_").first
end
return nil
end