From 645e839075d5e597e2cc4db4d83ff330b1bcdc18 Mon Sep 17 00:00:00 2001 From: Douglas Thrift Date: Sun, 21 Jul 2013 11:54:14 -0700 Subject: [OHAI-492] - IP address detection fails if there is an interface with no addresses * skip interfaces that have no addresses when sorting IP addresses --- lib/ohai/plugins/network.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/ohai/plugins') diff --git a/lib/ohai/plugins/network.rb b/lib/ohai/plugins/network.rb index 72a13109..3a679103 100644 --- a/lib/ohai/plugins/network.rb +++ b/lib/ohai/plugins/network.rb @@ -39,6 +39,7 @@ Ohai.plugin do ipaddresses = [] # ipaddresses going to hold #{family} ipaddresses and their scope Mash[network['interfaces']].each do |iface, iface_v| + next if iface_v.nil? or not iface_v.has_key? 'addresses' iface_v['addresses'].each do |addr, addr_v| next if addr_v.nil? or not addr_v.has_key? "family" or addr_v['family'] != family ipaddresses << { -- cgit v1.2.1