From: Tom Hughes Date: Fri, 8 Jan 2016 21:41:52 +0000 (+0000) Subject: Cope when no disk information has been gathered yet X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/21440c0e6c6c316e1fe7b74ea60897c2a0461681 Cope when no disk information has been gathered yet --- diff --git a/cookbooks/hardware/recipes/default.rb b/cookbooks/hardware/recipes/default.rb index d929bbf57..867f3a8aa 100644 --- a/cookbooks/hardware/recipes/default.rb +++ b/cookbooks/hardware/recipes/default.rb @@ -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]