Skip to content

Commit

Permalink
(FACT-2736) Add log messages in networking resolver.
Browse files Browse the repository at this point in the history
  • Loading branch information
BogdanIrimie committed Jul 31, 2020
1 parent fe1fb4e commit ae817ba
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/facter/resolvers/networking_linux_resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class << self
private

def post_resolve(fact_name)
log.debug('in networking_linux_resolver')
@fact_list.fetch(fact_name) { retrieve_network_info(fact_name) }

@fact_list[fact_name]
Expand All @@ -36,12 +37,17 @@ def retrieve_interfaces_mac_and_mtu
end

def retrieve_interface_info
log.debug('retrieve_interface_info')
output = Facter::Core::Execution.execute('ip -o address', logger: log)
log.debug("ip -o address result is:\n#{output}")

interfaces = {}

output.each_line do |ip_line|
ip_tokens = ip_line.split(' ')

log.debug("ip_tokens = #{ip_tokens}")
log.debug("interfaces = #{interfaces}")
fill_ip_v4_info!(ip_tokens, interfaces)
fill_io_v6_info!(ip_tokens, interfaces)
find_dhcp!(ip_tokens, interfaces)
Expand Down Expand Up @@ -93,10 +99,15 @@ def search_internal_leases(interface_name)
end

def fill_ip_v4_info!(ip_tokens, network_info)
log.debug('fill_ip_v4_info!')
return unless ip_tokens[2].casecmp('inet').zero?

interface_name, ip4_address, ip4_mask_length = retrieve_name_and_ip_info(ip_tokens)

log.debug("interface_name = #{interface_name}")
log.debug("ip4_address = #{ip4_address}")
log.debug("ip4_mask_length = #{ip4_mask_length}")

binding = ::Resolvers::Utils::Networking.build_binding(ip4_address, ip4_mask_length)
build_network_info_structure!(network_info, interface_name, :bindings)

Expand Down

0 comments on commit ae817ba

Please sign in to comment.