Class: Facts::Solaris::Virtual
- Inherits:
-
Object
- Object
- Facts::Solaris::Virtual
- Defined in:
- lib/facter/facts/solaris/virtual.rb
Constant Summary collapse
- FACT_NAME =
'virtual'
Instance Method Summary collapse
- #call_the_resolver ⇒ Object
- #check_ldom ⇒ Object
- #check_other_facts ⇒ Object
- #check_xen ⇒ Object
- #check_zone ⇒ Object
-
#initialize ⇒ Virtual
constructor
A new instance of Virtual.
Constructor Details
Instance Method Details
#call_the_resolver ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/facter/facts/solaris/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, fact_value) end |
#check_ldom ⇒ Object
22 23 24 25 26 27 |
# File 'lib/facter/facts/solaris/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/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 |