X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/fd1b5c3bba273140810558c086d5915d6aa53725..2c4864df71bbc4544feabf65f26c88bc8eb24c87:/cookbooks/hardware/templates/default/lldp.rb.erb?ds=sidebyside diff --git a/cookbooks/hardware/templates/default/lldp.rb.erb b/cookbooks/hardware/templates/default/lldp.rb.erb index 6ccd1cdfa..fb8d8cf0f 100644 --- a/cookbooks/hardware/templates/default/lldp.rb.erb +++ b/cookbooks/hardware/templates/default/lldp.rb.erb @@ -8,7 +8,13 @@ Ohai.plugin(:Lldp) do json = JSON.parse(%x(/usr/sbin/lldpctl -f json)) - json["lldp"]["interface"].each do |interface| + 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