]> git.openstreetmap.org Git - chef.git/commitdiff
The smartd on 12.04 doesn't support /dev/bus syntax
authorTom Hughes <tom@compton.nu>
Fri, 13 Mar 2015 11:14:39 +0000 (11:14 +0000)
committerTom Hughes <tom@compton.nu>
Fri, 13 Mar 2015 11:14:39 +0000 (11:14 +0000)
cookbooks/hardware/recipes/default.rb

index 80473f779e1f36a8395ca1f0d4799f81b033a2f2..c9da86168f4fe00eebcc0aabaa02dd967c1d33cc 100644 (file)
@@ -275,7 +275,8 @@ if status_packages["megaclisas-status"]
 
     next unless driver == "megaraid_sas"
 
-    device = host.sub("/sys/class/scsi_host/host", "bus/")
+    bus = host.sub("/sys/class/scsi_host/host", "")
+    device = File.basename(Dir.glob("/sys/bus/scsi/devices/#{bus}:*/scsi_generic/*").first)
 
     IO.popen(["megacli", "-PDList", "-a#{controller}", "-NoLog"]).each do |line|
       disks << { :device => device, :driver => "megaraid",  :id => Regexp.last_match[1] } if line =~ /^Device Id: ([0-9]+)$/