X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/faf8ae12e85eabb050b0f5eceb2cb67ad1de5261..c1d0a8f5d53831d9802830c979f0095d17a57305:/cookbooks/networking/libraries/interfaces.rb?ds=inline diff --git a/cookbooks/networking/libraries/interfaces.rb b/cookbooks/networking/libraries/interfaces.rb index cc9c11a23..cd9116dfa 100644 --- a/cookbooks/networking/libraries/interfaces.rb +++ b/cookbooks/networking/libraries/interfaces.rb @@ -6,15 +6,14 @@ class Chef networking = construct_attributes[:networking] || {} networking_interfaces = networking[:interfaces] || [] - networking_interfaces.each do |name,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 + networking_interfaces.each_value do |interface| + 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