From d8ff2cb5adca25d7eba2bdd334919770316c91be Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 22 Apr 2013 20:38:57 -0700 Subject: [PATCH] Attempt to read guest additions version from showvminfo [GH-1575] --- CHANGELOG.md | 2 ++ plugins/providers/virtualbox/driver/version_4_2.rb | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fcee2054..65fff61cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ IMPROVEMENTS: - Better locking around handling the `box_url` parameter for parallel providers. - Solaris guest is now properly detected on SmartOS, OmniOS, etc. [GH-1639] + - Guest addition version detection is more robust, attempting other + routes to get the version, and also retrying a few times. [GH-1575] BUG FIXES: diff --git a/plugins/providers/virtualbox/driver/version_4_2.rb b/plugins/providers/virtualbox/driver/version_4_2.rb index a145a6e69..dded1bc6f 100644 --- a/plugins/providers/virtualbox/driver/version_4_2.rb +++ b/plugins/providers/virtualbox/driver/version_4_2.rb @@ -264,6 +264,13 @@ module VagrantPlugins return value.split("_").first end + # If we can't get the guest additions version by guest property, try + # to get it from the VM info itself. + info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) + info.split("\n").each do |line| + return $1.to_s if line =~ /^GuestAdditionsVersion="(.+?)"$/ + end + return nil end