From: Tom Hughes Date: Mon, 30 Nov 2015 22:52:14 +0000 (+0000) Subject: Handle a wider range of Adaptec controllers X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/5afabe59a6d5302e37002d8c0b5c104972102944 Handle a wider range of Adaptec controllers --- diff --git a/cookbooks/hardware/templates/default/ohai.rb.erb b/cookbooks/hardware/templates/default/ohai.rb.erb index e4678992c..676fb3f70 100644 --- a/cookbooks/hardware/templates/default/ohai.rb.erb +++ b/cookbooks/hardware/templates/default/ohai.rb.erb @@ -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)