X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/6fdc460b8119e4469adc0107f81db2d9c5f0048e..b7ad0079c7b68733b52d84b5e9f32a68e0f0902b:/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 15e35050a..fb8d8cf0f 100644 --- a/cookbooks/hardware/templates/default/lldp.rb.erb +++ b/cookbooks/hardware/templates/default/lldp.rb.erb @@ -6,9 +6,15 @@ 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"]["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