Sha256: 0b10b5cba40b464ba1578516d9ff403512fd1fa257afc518df91efc2d30f93a0

Contents?: true

Size: 734 Bytes

Versions: 2

Compression:

Stored size: 734 Bytes

Contents

# frozen_string_literal: true

module Facts
  module Linux
    class Virtual
      FACT_NAME = 'virtual'

      def call_the_resolver
        fact_value = check_docker_lxc || check_gce || retrieve_from_virt_what || check_vmware

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

      def check_gce
        bios_vendor = Facter::Resolvers::Linux::DmiBios.resolve(:bios_vendor)
        'gce' if bios_vendor&.include?('Google')
      end

      def check_docker_lxc
        Facter::Resolvers::DockerLxc.resolve(:vm)
      end

      def check_vmware
        Facter::Resolvers::Vmware.resolve(:vm)
      end

      def retrieve_from_virt_what
        Facter::Resolvers::VirtWhat.resolve(:vm)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
facter-4.0.25 lib/facts/linux/virtual.rb
facter-4.0.24 lib/facts/linux/virtual.rb