Sha256: 632e2138c66468777fadc68e9571e7b5b4867868f2ade5c619f5a17a3bb14655
Contents?: true
Size: 1.18 KB
Versions: 3
Compression:
Stored size: 1.18 KB
Contents
module ForemanDiscovery class FactParser < ::PuppetFactParser def suggested_primary_interface(host) raise(::Foreman::Exception.new(N_("Discovery fact parser does not work with non-discovery host '%{host}'") % {:host => host})) if host.type != "Host::Discovered" raise(::Foreman::Exception.new(N_("Discovered host '%{host}' has all NICs filtered out, filter: %{filter}") % {:host => host, :filter => Setting[:ignored_interface_identifiers]})) if interfaces.size == 0 bootif_mac = FacterUtils::bootif_mac(facts).try(:downcase) detected = interfaces.detect { |_, values| values[:macaddress].try(:downcase) == bootif_mac } Rails.logger.debug "Discovery fact parser detected primary interface: #{detected}" # return the detected interface as array [name, facts] detected || raise(::Foreman::Exception.new(N_("Unable to find primary NIC with %{mac} specified via '%{fact}', NIC filter: %{filter}") % {:mac => bootif_mac, :fact => FacterUtils::bootif_name, :filter => Setting[:ignored_interface_identifiers]})) end def parse_interfaces? true # to make 'ignore_puppet_facts_for_provisioning' setting non-effective end end end
Version data entries
3 entries across 3 versions & 1 rubygems