X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/fd1b5c3bba273140810558c086d5915d6aa53725..cf163679e4cf9c867cde63fe724ba3e578660d0a:/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