From 54bcac2e7a13ae423d1ff818cb51eac3e8b21b35 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 27 Feb 2013 19:10:49 -0800 Subject: [PATCH] Only error if minor or major version of guest additions is different --- .../virtualbox/action/check_guest_additions.rb | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/plugins/providers/virtualbox/action/check_guest_additions.rb b/plugins/providers/virtualbox/action/check_guest_additions.rb index 2fd798814..a79b0eeeb 100644 --- a/plugins/providers/virtualbox/action/check_guest_additions.rb +++ b/plugins/providers/virtualbox/action/check_guest_additions.rb @@ -13,12 +13,21 @@ module VagrantPlugins if !version env[:ui].warn I18n.t("vagrant.actions.vm.check_guest_additions.not_detected") else - # Strip the -OSE/_OSE off from the guest additions and the virtual box - # version since all the matters are that the version _numbers_ match up. - guest_version, vb_version = [version, env[:machine].provider.driver.version].map do |v| - v.gsub(/[-_]ose/i, '') + # Read the versions + versions = [version, env[:machine].provider.driver.version] + + # 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 + guest_version = versions[0] + vb_version = versions[1] + if guest_version != vb_version env[:ui].warn(I18n.t("vagrant.actions.vm.check_guest_additions.version_mismatch", :guest_version => version,