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