]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/hardware/templates/default/ohai.rb.erb
Handle a wider range of Adaptec controllers
[chef.git] / cookbooks / hardware / templates / default / ohai.rb.erb
index e4678992c3aaed2d7158de43ec5c754460fcab66..676fb3f70c68bb98663555247b0a08fd9814310f 100644 (file)
@@ -521,11 +521,12 @@ Ohai.plugin(:Hardware) do
 
           arrays << array
         elsif line =~ /^      Device #(\d+)$/
+          disk = nil
+        elsif line =~ /^         Device is a Hard drive$/
           disk = {
             :id => devices[:disks].count,
             :controller => controller[:id],
-            :arrays => [],
-            :number => Regexp.last_match(1).to_i
+            :arrays => []
           }
 
           devices[:disks] << disk
@@ -544,9 +545,10 @@ Ohai.plugin(:Hardware) do
           when "Serial" then disk[:serial_number] = Regexp.last_match(2)
           when "World-wide name" then disk[:wwn] = Regexp.last_match(2)
           when "Total Size" then disk[:size] = memory_to_disk_size(Regexp.last_match(2))
+          when "Size" then disk[:size] = memory_to_disk_size(Regexp.last_match(2))
           end
-        elsif array && line =~ / Present \(Controller:\d+,Connector:(\d+),Device:(\d+)\) /
-          array[:disks] << "Connector #{Regexp.last_match(1)}, Device #{Regexp.last_match(2)}"
+        elsif array && line =~ / Present \(Controller:\d+,((?:Connector|Enclosure):\d+,(?:Device|Slot):\d+)\) /
+          array[:disks] << Regexp.last_match(1).gsub(":", " ").gsub(",", ", ")
         elsif array && line =~ /^   (\S.*\S)\s*:\s+(\S.*\S)\s*$/
           case Regexp.last_match(1)
           when "RAID level" then array[:raid_level] = Regexp.last_match(2)