Sha256: 1fac0711b779c64bb74033980ba5615b0d90825cb8ae7947235d76aafefc2975

Contents?: true

Size: 1.79 KB

Versions: 63

Compression:

Stored size: 1.79 KB

Contents

require "log4r"

module VagrantPlugins
  module ProviderVirtualBox
    module Action
      class CheckGuestAdditions
        def initialize(app, env)
          @app = app
          @logger = Log4r::Logger.new("vagrant::plugins::virtualbox::check_guest_additions")
        end

        def call(env)
          if !env[:machine].provider_config.check_guest_additions
            @logger.info("Not checking guest additions because configuration")
            return @app.call(env)
          end

          env[:ui].output(I18n.t("vagrant.virtualbox.checking_guest_additions"))

          # Use the raw interface for now, while the virtualbox gem
          # doesn't support guest properties (due to cross platform issues)
          version = env[:machine].provider.driver.read_guest_additions_version
          if !version
            env[:ui].detail(I18n.t("vagrant.actions.vm.check_guest_additions.not_detected"))
          else
            # 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].detail(I18n.t("vagrant.actions.vm.check_guest_additions.version_mismatch",
                                   guest_version: version,
                                   virtualbox_version: vb_version))
            end
          end

          # Continue
          @app.call(env)
        end

      end
    end
  end
end

Version data entries

63 entries across 56 versions & 8 rubygems

Version Path
vagrant-unbundled-2.2.0.0 plugins/providers/virtualbox/action/check_guest_additions.rb
vagrant-unbundled-2.1.4.0 plugins/providers/virtualbox/action/check_guest_additions.rb
vagrant-unbundled-2.1.2.0 plugins/providers/virtualbox/action/check_guest_additions.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/virtualbox/action/check_guest_additions.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/virtualbox/action/check_guest_additions.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/virtualbox/action/check_guest_additions.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/virtualbox/action/check_guest_additions.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/virtualbox/action/check_guest_additions.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/virtualbox/action/check_guest_additions.rb
vagrant-unbundled-2.1.1.0 plugins/providers/virtualbox/action/check_guest_additions.rb
vagrant-unbundled-2.0.4.0 plugins/providers/virtualbox/action/check_guest_additions.rb
vagrant-unbundled-2.0.3.0 plugins/providers/virtualbox/action/check_guest_additions.rb
vagrant-aws-detiber-0.7.2.pre.4 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/plugins/providers/virtualbox/action/check_guest_additions.rb
vagrant-aws-detiber-0.7.2.pre.3 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/plugins/providers/virtualbox/action/check_guest_additions.rb
vagrant-aws-detiber-0.7.2.pre.2 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/plugins/providers/virtualbox/action/check_guest_additions.rb
vagrant-unbundled-2.0.2.0 plugins/providers/virtualbox/action/check_guest_additions.rb
vagrant-unbundled-2.0.1.0 plugins/providers/virtualbox/action/check_guest_additions.rb
vagrant-aws-mkubenka-0.7.2.pre.22 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-f3fdbf414272/plugins/providers/virtualbox/action/check_guest_additions.rb
vagrant-aws-mkubenka-0.7.2.pre.16 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-1ee58c40e3f5/plugins/providers/virtualbox/action/check_guest_additions.rb
vagrant-unbundled-2.0.0.1 plugins/providers/virtualbox/action/check_guest_additions.rb