Sha256: c1ae971172ed3bba56fba7a9dcae8391c7bbb91a25cc345f66a14042c1f4c665

Contents?: true

Size: 1.02 KB

Versions: 54

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module Facts
  module Linux
    module Hypervisors
      class Vmware
        FACT_NAME = 'hypervisors.vmware'

        def initialize
          @log = Facter::Log.new(self)
        end

        def call_the_resolver
          if vmware?
            @log.debug('Vmware hypervisor detected')
            fact_value = {}

            version = Facter::Resolvers::DmiDecode.resolve(:vmware_version)
            fact_value[:version] = version if version && !version.empty?

            return Facter::ResolvedFact.new(FACT_NAME, fact_value)
          end

          @log.debug('No Vmware hypervisor detected.')
          []
        end

        private

        def vmware?
          Facter::Resolvers::VirtWhat.resolve(:vm) == 'vmware' ||
            Facter::Resolvers::Linux::DmiBios.resolve(:product_name) == 'VMware' ||
            Facter::Resolvers::Lspci.resolve(:vm) == 'vmware' ||
            Facter::Resolvers::Linux::DmiBios.resolve(:sys_vendor) == 'VMware, Inc.'
        end
      end
    end
  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
facter-4.2.10 lib/facter/facts/linux/hypervisors/vmware.rb
facter-4.2.9 lib/facter/facts/linux/hypervisors/vmware.rb
facter-4.2.8 lib/facter/facts/linux/hypervisors/vmware.rb
facter-4.2.7 lib/facter/facts/linux/hypervisors/vmware.rb
facter-4.2.6 lib/facter/facts/linux/hypervisors/vmware.rb
facter-4.2.5 lib/facter/facts/linux/hypervisors/vmware.rb
facter-4.2.4 lib/facter/facts/linux/hypervisors/vmware.rb
facter-4.2.3 lib/facter/facts/linux/hypervisors/vmware.rb
facter-4.2.2 lib/facter/facts/linux/hypervisors/vmware.rb
facter-4.2.1 lib/facter/facts/linux/hypervisors/vmware.rb
facter-4.2.0 lib/facter/facts/linux/hypervisors/vmware.rb
facter-4.1.1 lib/facter/facts/linux/hypervisors/vmware.rb
facter-4.1.0 lib/facter/facts/linux/hypervisors/vmware.rb
facter-4.0.52 lib/facter/facts/linux/hypervisors/vmware.rb
facter-4.0.51 lib/facter/facts/linux/hypervisors/vmware.rb
facter-4.0.50 lib/facter/facts/linux/hypervisors/vmware.rb
facter-4.0.49 lib/facter/facts/linux/hypervisors/vmware.rb
facter-4.0.48 lib/facter/facts/linux/hypervisors/vmware.rb
facter-4.0.47 lib/facter/facts/linux/hypervisors/vmware.rb
facter-4.0.46 lib/facter/facts/linux/hypervisors/vmware.rb