Class: VagrantVbguest::Hosts::VirtualBox
- Defined in:
- lib/vagrant-vbguest/hosts/virtualbox.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#additions_file, #cleanup, #initialize, #version
Methods included from VagrantVbguest::Helpers::VmCompatible
#communicate, #driver, included
Constructor Details
This class inherits a constructor from VagrantVbguest::Hosts::Base
Instance Method Details
#read_guest_additions_version ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/vagrant-vbguest/hosts/virtualbox.rb', line 5 def read_guest_additions_version # this way of checking for the GuestAdditionsVersion is taken from Vagrant's # `read_guest_additions_version` method introduced via # https://github.com/hashicorp/vagrant/commit/d8ff2cb5adca25d7eba2bdd334919770316c91be # for VirtualBox 4.2 and carries on for later versons until now # We are vendoring it here, since Vagrant uses it is only a fallback # for when `guestproperty` won't work. But `guestproperty` seems to be prone # to return incorrect values. if Gem::Requirement.new(">= 4.2").satisfied_by? Gem::Version.new(version) uuid = self.class.vm_id(vm) begin info = driver.execute("showvminfo", uuid, "--machinereadable", retryable: true) info.split("\n").each do |line| return $1.to_s if line =~ /^GuestAdditionsVersion="(.+?)"$/ end rescue Vagrant::Errors::VBoxManageError => e if e. =~ /Invalid command.*showvminfo/i vm.env.ui.warn("Cannot read GuestAdditionsVersion using 'showvminfo'") vm.env.ui.debug(e.) else raise e end end end super end |