]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/hardware/templates/default/lldp.rb.erb
Remove remnants of mcelog
[chef.git] / cookbooks / hardware / templates / default / lldp.rb.erb
index 4932cd06971c651b0b2f84f10647eebcd745063e..fb8d8cf0ff41ef1e57b6bac7574365bcb76095f1 100644 (file)
@@ -6,10 +6,18 @@ 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"].each do |key, value|
-      lldp[key] = value
+    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
     end
 
     lldp