Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(FACT-2736) networking facts don't work on EXADATA baremetal #2008

Merged
merged 1 commit into from
Aug 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}\n" \
"ip4_address = #{ip4_address}\n" \
"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
2 changes: 2 additions & 0 deletions lib/facter/resolvers/utils/networking.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require 'ipaddr'

module Resolvers
module Utils
module Networking
Expand Down
2 changes: 0 additions & 2 deletions lib/facter/resolvers/windows/networking_resolver.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require 'ipaddr'

module Facter
module Resolvers
class Networking < BaseResolver
Expand Down