]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/networking/libraries/interfaces.rb
nominatim: one more typo
[chef.git] / cookbooks / networking / libraries / interfaces.rb
index cc9c11a232a33b4795bb2bf252e33dfe48f8f0ea..cd9116dfa8be051956ef6550332e4dc1dbdb10f1 100644 (file)
@@ -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