X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/191aa8d721ed6adfd7fad6bb766c432ef5f70363..0a03f6f0a910dec8b7f2c99c2aa97db1541afd28:/cookbooks/hardware/templates/default/lldp.rb.erb diff --git a/cookbooks/hardware/templates/default/lldp.rb.erb b/cookbooks/hardware/templates/default/lldp.rb.erb index 4932cd069..fb8d8cf0f 100644 --- a/cookbooks/hardware/templates/default/lldp.rb.erb +++ b/cookbooks/hardware/templates/default/lldp.rb.erb @@ -6,10 +6,18 @@ Ohai.plugin(:Lldp) do collect_data(:default) do lldp Mash.new - json = JSON.parse(%x(/sbin/lldpctl -f json)) + json = JSON.parse(%x(/usr/sbin/lldpctl -f json)) - json["lldp"].each do |key, value| - lldp[key] = value + interfaces = if json["lldp"]["interface"].is_a?(Array) + json["lldp"]["interface"] + else + [json["lldp"]["interface"]] + end + + interfaces.each do |interface| + interface.each do |name, details| + lldp[name] = details + end end lldp