Only error if minor or major version of guest additions is different

This commit is contained in:
Mitchell Hashimoto 2013-02-27 19:10:49 -08:00
parent 8d51c7e300
commit 54bcac2e7a
1 changed files with 13 additions and 4 deletions

View File

@ -13,12 +13,21 @@ module VagrantPlugins
if !version if !version
env[:ui].warn I18n.t("vagrant.actions.vm.check_guest_additions.not_detected") env[:ui].warn I18n.t("vagrant.actions.vm.check_guest_additions.not_detected")
else else
# Strip the -OSE/_OSE off from the guest additions and the virtual box # Read the versions
# version since all the matters are that the version _numbers_ match up. versions = [version, env[:machine].provider.driver.version]
guest_version, vb_version = [version, env[:machine].provider.driver.version].map do |v|
v.gsub(/[-_]ose/i, '') # Strip of any -OSE or _OSE and read only the first two parts
# of the version such as "4.2" in "4.2.0"
versions.map! do |v|
v = v.gsub(/[-_]ose/i, '')
match = /^(\d+\.\d+)\.(\d+)/.match(v)
v = match[1] if match
v
end end
guest_version = versions[0]
vb_version = versions[1]
if guest_version != vb_version if guest_version != vb_version
env[:ui].warn(I18n.t("vagrant.actions.vm.check_guest_additions.version_mismatch", env[:ui].warn(I18n.t("vagrant.actions.vm.check_guest_additions.version_mismatch",
:guest_version => version, :guest_version => version,