From f0953bbd48a2310f6046b88e35c4f5950f13dda7 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 22 Dec 2015 22:34:25 +0000 Subject: [PATCH 1/1] Ignore disks with no device --- cookbooks/hardware/recipes/default.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cookbooks/hardware/recipes/default.rb b/cookbooks/hardware/recipes/default.rb index c29185248..0b7b3e6f3 100644 --- a/cookbooks/hardware/recipes/default.rb +++ b/cookbooks/hardware/recipes/default.rb @@ -311,11 +311,13 @@ disks = node[:hardware][:disk][:disks].map do |disk| elsif smart =~ %r{^.*,(\d+)/(\d+)$} munin = "#{device}-#{Regexp.last_match(1)}:#{Regexp.last_match(2)}" end - else + elsif disk[:device] device = disk[:device].sub("/dev/", "") munin = device end + next if device.nil? + Hash[ :device => device, :smart => smart, @@ -324,6 +326,8 @@ disks = node[:hardware][:disk][:disks].map do |disk| ] end +disks = disks.compact + if disks.count > 0 package "smartmontools" -- 2.43.2