]> git.openstreetmap.org Git - chef.git/commitdiff
Cope when no disk information has been gathered yet
authorTom Hughes <tom@compton.nu>
Fri, 8 Jan 2016 21:41:52 +0000 (21:41 +0000)
committerTom Hughes <tom@compton.nu>
Fri, 8 Jan 2016 21:43:00 +0000 (21:43 +0000)
cookbooks/hardware/recipes/default.rb

index d929bbf5746f3ae6927bcd05529bb7ded68175b4..867f3a8aa55d43eb3ff23e28768e68b4f0b72b4c 100644 (file)
@@ -297,7 +297,13 @@ end
   end
 end
 
-disks = node[:hardware][:disk][:disks].map do |disk|
+if node[:hardware][:disk]
+  disks = node[:hardware][:disk][:disks]
+else
+  disks = []
+end
+
+disks = disks.map do |disk|
   next if disk[:state] == "spun_down"
 
   if disk[:smart_device]