Method: Vagrant::Action::VM::CheckGuestAdditions#call

Defined in:
lib/vagrant/action/vm/check_guest_additions.rb

#call(env) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/vagrant/action/vm/check_guest_additions.rb', line 12

def call(env)
  # Use the raw interface for now, while the virtualbox gem
  # doesn't support guest properties (due to cross platform issues)
  version = env[:vm].driver.read_guest_additions_version
  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[:vm].driver.version].map do |v|
      v.gsub(/[-_]ose/i, '')
    end

    if guest_version != vb_version
      env[:ui].warn(I18n.t("vagrant.actions.vm.check_guest_additions.version_mismatch",
                           :guest_version => version,
                           :virtualbox_version => vb_version))
    end
  end

  # Continue
  @app.call(env)
end