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