Sha256: 6fb7cb347537fdeaf389e82e2317804bf5cdf93f7a9193d6ce1f45966f3fdee7

Contents?: true

Size: 1.23 KB

Versions: 9

Compression:

Stored size: 1.23 KB

Contents

module Vagrant
  class Action
    module VM
      # Middleware which verifies that the VM has the proper guest additions
      # installed and prints a warning if they're not detected or if the
      # version does not match the installed VirtualBox version.
      class CheckGuestAdditions
        def initialize(app, env)
          @app = app
        end

        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"].vm.interface.get_guest_property_value("/VirtualBox/GuestAdd/Version")
          if version.empty?
            env.ui.warn I18n.t("vagrant.actions.vm.check_guest_additions.not_detected")
          else
            # Strip the -OSE/_OSE off from the guest additions
            version = version.gsub(/[-_]ose/i, '')

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

          # Continue
          @app.call(env)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
vagrantup-0.8.7 lib/vagrant/action/vm/check_guest_additions.rb
vagrantup-0.8.6 lib/vagrant/action/vm/check_guest_additions.rb
vagrantup-0.8.5 lib/vagrant/action/vm/check_guest_additions.rb
vagrantup-0.8.4 lib/vagrant/action/vm/check_guest_additions.rb
vagrantup-0.8.3 lib/vagrant/action/vm/check_guest_additions.rb
vagrant-0.8.7 lib/vagrant/action/vm/check_guest_additions.rb
rvagrant-0.8.7.dev lib/vagrant/action/vm/check_guest_additions.rb
vagrant-0.8.6 lib/vagrant/action/vm/check_guest_additions.rb
vagrant-0.8.5 lib/vagrant/action/vm/check_guest_additions.rb