lib/ohai/plugins/network.rb in ohai-0.6.8 vs lib/ohai/plugins/network.rb in ohai-0.6.10.rc.1
- old
+ new
@@ -34,10 +34,13 @@
break if (ip and mac)
end
[ip, mac]
end
-if network[:default_interface]
+# If we have a default interface that has addresses, populate the short-cut attributes
+if network[:default_interface] and
+ network["interfaces"][network[:default_interface]] and
+ network["interfaces"][network[:default_interface]]["addresses"]
Ohai::Log.debug("Using default interface for default ip and mac address")
im = find_ip_and_mac(network["interfaces"][network[:default_interface]]["addresses"])
ipaddress im.shift
macaddress im.shift
else