Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 0.2.0
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
ipaddress_eth0 = host["network"]["interfaces"]["eth0"]["addresses"].select { |address, data| data["family"] == "inet" }[0][0]
["ipaddress"] tends to be the last address found? Currently eth1 in my test case.
You could do ipaddress as a hash with interface names as a key, if you want to stick with ipv4 being what we usually want.
Please merge https://github.com/toomasp/ohai/tree/OHAI-88
getting the ip of the interface is as easy as ipaddress_eth0 = @ohai.get_interface_ip("eth0")