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 d929bbf..867f3a8 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]