Sha256: a1ce2cbd6590fb7c5f15a480272cb3788a8efaa9c59f2cd9397dee6b4c820325
Contents?: true
Size: 839 Bytes
Versions: 7
Compression:
Stored size: 839 Bytes
Contents
# frozen_string_literal: true module Facts module Macosx class IsVirtual FACT_NAME = 'is_virtual' def call_the_resolver Facter::ResolvedFact.new(FACT_NAME, virtual?) end private def virtual? hypervisor_name != nil end def hypervisor_name model_identifier = Facter::Resolvers::Macosx::SystemProfiler.resolve(:model_identifier) return 'vmware' if model_identifier&.start_with?('VMware') boot_rom_version = Facter::Resolvers::Macosx::SystemProfiler.resolve(:boot_rom_version) return 'virtualbox' if boot_rom_version&.start_with?('VirtualBox') subsystem_vendor_id = Facter::Resolvers::Macosx::SystemProfiler.resolve(:subsystem_vendor_id) 'parallels' if subsystem_vendor_id&.start_with?('0x1ab8') end end end end
Version data entries
7 entries across 7 versions & 1 rubygems