]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/hardware/templates/default/ohai.rb.erb
Make nftables block various invalid TCP flag combinations
[chef.git] / cookbooks / hardware / templates / default / ohai.rb.erb
index 2fca2b323c63f758630abd78a36b48885aea2802..a2eb0ef967d8811b2b912392850f4d677e6a7e0d 100644 (file)
@@ -331,6 +331,7 @@ Ohai.plugin(:Hardware) do
         when "Hardware Revision" then controller[:hardware_version] = Regexp.last_match(2)
         when "Firmware Version" then controller[:firmware_version] = Regexp.last_match(2)
         when "PCI Address (Domain:Bus:Device.Function)" then controller[:pci_slot] = Regexp.last_match(2)
         when "Hardware Revision" then controller[:hardware_version] = Regexp.last_match(2)
         when "Firmware Version" then controller[:firmware_version] = Regexp.last_match(2)
         when "PCI Address (Domain:Bus:Device.Function)" then controller[:pci_slot] = Regexp.last_match(2)
+        when "Battery/Capacitor Status" then controller[:battery_status] = Regexp.last_match(2).split.first.downcase
         end
       elsif controller && line =~ /^      Logical Drive: (\d+)$/
         array = {
         end
       elsif controller && line =~ /^      Logical Drive: (\d+)$/
         array = {
@@ -403,6 +404,10 @@ Ohai.plugin(:Hardware) do
     end
 
     devices[:disks].each do |disk|
     end
 
     devices[:disks].each do |disk|
+      controller = disk[:controller]
+
+      next unless devices[:controllers][controller][:type] == "hp"
+
       disk[:smart_device] = "cciss,#{disks.find_index(disk[:location])}"
 
       if disk[:status] == "Failed"
       disk[:smart_device] = "cciss,#{disks.find_index(disk[:location])}"
 
       if disk[:status] == "Failed"
@@ -597,12 +602,13 @@ Ohai.plugin(:Hardware) do
 
     disks.each do |disk|
       controller = devices[:controllers][disk[:controller]]
 
     disks.each do |disk|
       controller = devices[:controllers][disk[:controller]]
-      id = disk.delete(:device_id)
 
 
-      if device = Dir.glob("/sys/bus/pci/devices/#{controller[:pci_slot]}/host*/target0:0:#{id}/0:0:#{id}:0/block/sd*").first
-        disk[:device] = "/dev/#{File.basename(device)}"
-      else
-        disk[:smart_device] = "megaraid,#{id}"
+      if id = disk.delete(:device_id)
+        if device = Dir.glob("/sys/bus/pci/devices/#{controller[:pci_slot]}/host*/target0:0:#{id}/0:0:#{id}:0/block/sd*").first
+          disk[:device] = "/dev/#{File.basename(device)}"
+        else
+          disk[:smart_device] = "megaraid,#{id}"
+        end
       end
     end
   end
       end
     end
   end