From: Tom Hughes Date: Fri, 15 Mar 2019 16:26:30 +0000 (+0000) Subject: Avoid exception when an interface has no flags X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/b5b025beaf095afbe4b53005c6f308e44c4af3eb?hp=7f8cb5ed5c29db37b8c9ed7cec704028689525d2 Avoid exception when an interface has no flags --- diff --git a/cookbooks/munin/recipes/default.rb b/cookbooks/munin/recipes/default.rb index df7bfbe08..3418d3e83 100644 --- a/cookbooks/munin/recipes/default.rb +++ b/cookbooks/munin/recipes/default.rb @@ -160,7 +160,7 @@ munin_plugin "http_loadtime" do end node[:network][:interfaces].each do |ifname, ifattr| - if ifattr[:flags].include?("UP") && !ifattr[:flags].include?("LOOPBACK") + if ifattr[:flags]&.include?("UP") && !ifattr[:flags].include?("LOOPBACK") if node[:hardware] && node[:hardware][:network] && node[:hardware][:network][ifname][:device] =~ /^virtio/