Sha256: 6151093e96788d133d76938a0b0b4496283e209f86fee6b2615f59d45728d3e4
Contents?: true
Size: 1.7 KB
Versions: 4
Compression:
Stored size: 1.7 KB
Contents
module Katello class RhsmFactParser < ::FactParser def architecture name = facts['lscpu.architecture'] name = "x86_64" if name == "amd64" Architecture.where(:name => name).first_or_create unless name.blank? end def model if facts['virt::is_guest'] == "true" name = facts['lscpu.hypervisor_vendor'] else name = facts['dmi.system.product_name'] end ::Model.where(:name => name.strip).first_or_create unless name.blank? end def support_interfaces_parsing? true end def get_facts_for_interface(interface) { 'link' => true, 'macaddress' => facts["net.interface.#{interface}.mac_address"], 'ipaddress' => facts["net.interface.#{interface}.ipv4_address"] } end # rubocop:disable Style/AccessorMethodName: def get_interfaces mac_keys = facts.keys.select { |f| f =~ /net\.interface\..*\.mac_address/ } names = mac_keys.map do |key| key.sub('net.interface.', '').sub('.mac_address', '') if facts[key] != 'none' end names.compact end def operatingsystem name = facts['distribution.name'] version = facts['distribution.version'] return nil if name.nil? || version.nil? os_name = ::Katello::Candlepin::Consumer.distribution_to_puppet_os(name) if os_name major, minor = version.split('.') os_attributes = {:major => major, :minor => minor || '', :name => os_name} ::Operatingsystem.find_by(os_attributes) || ::Operatingsystem.create!(os_attributes) end end #required to be defined, even if they return nil def domain end def environment end def ipmi_interface end end end
Version data entries
4 entries across 4 versions & 1 rubygems