X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/b20599b6503be65674c3e420be6cca91b507ac0a..1b506c7210655ca2f4ea844cd076e44869d6e6a2:/cookbooks/networking/libraries/interfaces.rb?ds=sidebyside diff --git a/cookbooks/networking/libraries/interfaces.rb b/cookbooks/networking/libraries/interfaces.rb index 67b2bd237..029cb4f32 100644 --- a/cookbooks/networking/libraries/interfaces.rb +++ b/cookbooks/networking/libraries/interfaces.rb @@ -4,17 +4,16 @@ class Chef interfaces = [] networking = construct_attributes[:networking] || {} - networking_interfaces = networking[:interfaces] || [] + networking_interfaces = networking[:interfaces] || {} networking_interfaces.each_value do |interface| - if options[:role].nil? or interface[:role].to_s == options[:role].to_s - if options[:family].nil? or interface[:family].to_s == options[:family].to_s - if block.nil? - interfaces << interface - else - block.call(interface) - end - end + next unless options[:role].nil? || interface[:role].to_s == options[:role].to_s + next unless options[:family].nil? || interface[:family].to_s == options[:family].to_s + + if block.nil? + interfaces << interface + else + block.call(interface) end end