Don't rely on ohai hardware plugin having been run
authorTom Hughes <tom@compton.nu>
Thu, 27 Oct 2016 08:29:03 +0000 (09:29 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 27 Oct 2016 09:01:30 +0000 (10:01 +0100)
cookbooks/munin/recipes/default.rb

index 3b41eb8e9c52d58a29ee89d42da26fd2b6933291..1b4ae6d75d857346292d4eb89a4170cba741e7d1 100644 (file)
@@ -162,7 +162,7 @@ end
 
 node[:network][:interfaces].each do |ifname, ifattr|
   if ifattr[:encapsulation] == "Ethernet" && ifattr[:state] == "up"
-    if node[:hardware][:network][ifname][:device] =~ /^virtio/
+    if node[:hardware] && node[:hardware][:network][ifname][:device] =~ /^virtio/
       munin_plugin_conf "if_#{ifname}" do
         template "if.erb"
         variables :ifname => ifname