lib/facter/util/resolvers/networking/networking.rb in facter-4.4.1 vs lib/facter/util/resolvers/networking/networking.rb in facter-4.4.2
- old
+ new
@@ -34,11 +34,13 @@
def expand_main_bindings(networking_facts)
primary = networking_facts[:primary_interface]
interfaces = networking_facts[:interfaces]
expand_interfaces(interfaces) unless interfaces.nil?
- expand_primary_interface(networking_facts, primary) unless primary.nil? || interfaces.nil?
+ return if primary.nil? || interfaces.nil? || networking_facts.nil?
+
+ expand_primary_interface(networking_facts, primary)
end
def get_scope(ip)
require 'socket'
@@ -103,10 +105,10 @@
expand_binding(values, values[:bindings6], false) if values[:bindings6]
end
end
def expand_primary_interface(networking_facts, primary)
- networking_facts[:interfaces][primary].each do |key, value|
+ networking_facts[:interfaces][primary]&.each do |key, value|
networking_facts[key] = value unless %i[bindings bindings6].include?(key)
end
end
def expand_binding(values, bindings, ipv4_type = true)