]> git.openstreetmap.org Git - chef.git/commitdiff
Don't apply HP disk rules to disks not on HP controllers
authorTom Hughes <tom@compton.nu>
Thu, 22 Dec 2022 20:22:09 +0000 (20:22 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 22 Dec 2022 20:22:09 +0000 (20:22 +0000)
cookbooks/hardware/templates/default/ohai.rb.erb

index 536377de4d136fa1407d84971f17e39b26f6007e..b6064b38465184f3930eba4189661e2c9c928f20 100644 (file)
@@ -403,9 +403,11 @@ Ohai.plugin(:Hardware) do
     end
 
     devices[:disks].each do |disk|
     end
 
     devices[:disks].each do |disk|
-      if location = disks.find_index(disk[:location])
-        disk[:smart_device] = "cciss,#{location}"
-      end
+      controller = disk[:controller]
+
+      next unless devices[:controllers][controller][:type] == "hp"
+
+      disk[:smart_device] = "cciss,#{disks.find_index(disk[:location])}"
 
       if disk[:status] == "Failed"
         disk[:status] = "failed"
 
       if disk[:status] == "Failed"
         disk[:status] = "failed"