]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/hardware/templates/default/lldp.rb.erb
Fix detection of pass through disks on megaraid controllers
[chef.git] / cookbooks / hardware / templates / default / lldp.rb.erb
index 6ccd1cdfa4c73e89bf456e12f7f3e1632b2c702e..fb8d8cf0ff41ef1e57b6bac7574365bcb76095f1 100644 (file)
@@ -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