Sha256: 1f89972bd70039f7bc08ff68561f2cd9c6999ed2fbf5e51cb5ab4410a968bf09

Contents?: true

Size: 515 Bytes

Versions: 2

Compression:

Stored size: 515 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
        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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
facter-4.0.23 lib/facts/linux/virtual.rb
facter-4.0.22 lib/facts/linux/virtual.rb