Class: Facts::Solaris::IsVirtual
- Inherits:
-
Object
- Object
- Facts::Solaris::IsVirtual
- Defined in:
- lib/facter/facts/solaris/is_virtual.rb
Constant Summary collapse
- FACT_NAME =
'is_virtual'
Instance Method Summary collapse
- #call_the_resolver ⇒ Object
- #check_if_virtual(found_vm) ⇒ Object
- #check_ldom ⇒ Object
- #check_other_facts ⇒ Object
- #check_xen ⇒ Object
- #check_zone ⇒ Object
-
#initialize ⇒ IsVirtual
constructor
A new instance of IsVirtual.
Constructor Details
Instance Method Details
#call_the_resolver ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/facter/facts/solaris/is_virtual.rb', line 12 def call_the_resolver @log.debug('Solaris Virtual Resolver') fact_value = check_ldom || check_zone || check_xen || check_other_facts || 'physical' @log.debug("Fact value is: #{fact_value}") Facter::ResolvedFact.new(FACT_NAME, check_if_virtual(fact_value)) end |
#check_if_virtual(found_vm) ⇒ Object
59 60 61 |
# File 'lib/facter/facts/solaris/is_virtual.rb', line 59 def check_if_virtual(found_vm) Facter::Util::Facts::PHYSICAL_HYPERVISORS.count(found_vm).zero? end |
#check_ldom ⇒ Object
22 23 24 25 26 27 |
# File 'lib/facter/facts/solaris/is_virtual.rb', line 22 def check_ldom @log.debug('Checking LDoms') return unless Facter::Resolvers::Solaris::Ldom.resolve(:role_control) == 'false' Facter::Resolvers::Solaris::Ldom.resolve(:role_impl) end |
#check_other_facts ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/facter/facts/solaris/is_virtual.rb', line 43 def check_other_facts isa = Facter::Resolvers::Uname.resolve(:processor) klass = isa == 'sparc' ? 'DmiSparc' : 'Dmi' product_name = Facter::Resolvers::Solaris.const_get(klass).resolve(:product_name) bios_vendor = Facter::Resolvers::Solaris.const_get(klass).resolve(:bios_vendor) return 'kvm' if bios_vendor&.include?('Amazon EC2') return unless product_name Facter::Util::Facts::HYPERVISORS_HASH.each { |key, value| return value if product_name.include?(key) } nil end |