From a9f84d3b2526857bb3eb067ac94aea53c1954f4d Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 22 Dec 2022 19:53:26 +0000 Subject: [PATCH] Don't set smart_device for cciss disks which aren't in the PD list --- cookbooks/hardware/templates/default/ohai.rb.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cookbooks/hardware/templates/default/ohai.rb.erb b/cookbooks/hardware/templates/default/ohai.rb.erb index 6e6e5f37e..536377de4 100644 --- a/cookbooks/hardware/templates/default/ohai.rb.erb +++ b/cookbooks/hardware/templates/default/ohai.rb.erb @@ -403,7 +403,9 @@ Ohai.plugin(:Hardware) do end devices[:disks].each do |disk| - disk[:smart_device] = "cciss,#{disks.find_index(disk[:location])}" + if location = disks.find_index(disk[:location]) + disk[:smart_device] = "cciss,#{location}" + end if disk[:status] == "Failed" disk[:status] = "failed" -- 2.39.5