diff options
author | Chris Soyars <ctso@ctso.me> | 2016-02-12 14:16:58 -0500 |
---|---|---|
committer | Chris Soyars <ctso@ctso.me> | 2016-02-12 14:16:58 -0500 |
commit | e6f252bd0752b01490b225042a5d7bf94bd53498 (patch) | |
tree | 85ab9409e4eef5f48b9e65b68cab6a8299b0f59c | |
parent | ac9f5a2ae4ada9f2e6e821418ed3a9039bda9a91 (diff) | |
download | ohai-e6f252bd0752b01490b225042a5d7bf94bd53498.tar.gz |
Fix digital ocean ip address detection
IpHelper's loopback? method fails when you pass it a MAC address, so we
should check for this first
-rw-r--r-- | lib/ohai/plugins/digital_ocean.rb | 2 | ||||
-rw-r--r-- | spec/unit/plugins/digital_ocean_spec.rb | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/ohai/plugins/digital_ocean.rb b/lib/ohai/plugins/digital_ocean.rb index a9414c41..a72127b6 100644 --- a/lib/ohai/plugins/digital_ocean.rb +++ b/lib/ohai/plugins/digital_ocean.rb @@ -28,7 +28,7 @@ Ohai.plugin(:DigitalOcean) do addresses = Mash.new({ "v4" => [], "v6" => [] }) network[:interfaces].each_value do |iface| iface[:addresses].each do |address, details| - next if loopback?(address) || details[:family] == "lladdr" + next if details[:family] == "lladdr" || loopback?(address) ip = IPAddress(address) type = digital_ocean_address_type(ip) diff --git a/spec/unit/plugins/digital_ocean_spec.rb b/spec/unit/plugins/digital_ocean_spec.rb index 09b1f8c4..12e4ddfe 100644 --- a/spec/unit/plugins/digital_ocean_spec.rb +++ b/spec/unit/plugins/digital_ocean_spec.rb @@ -42,6 +42,9 @@ describe Ohai::System, "plugin digital_ocean" do "interfaces" => { "eth0" => { "addresses" => { + "00:D3:AD:B3:3F:00" => { + "family": "lladdr" + }, "1.2.3.4" => { "netmask" => "255.255.255.0" }, |