]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/networking/libraries/ipaddresses.rb
Mark slave interfaces in a bond as optional
[chef.git] / cookbooks / networking / libraries / ipaddresses.rb
index 51ef152b52fab21ee07c891f5ccdfe48886ac6b4..67c89d052192e6574df873751e3a44ea63b42d99 100644 (file)
@@ -4,22 +4,26 @@ class Chef
       addresses = []
 
       interfaces(options).each do |interface|
       addresses = []
 
       interfaces(options).each do |interface|
+        address = interface[:public_address] || interface[:address]
+
+        next if address.nil?
+
         if block.nil?
         if block.nil?
-          addresses << interface[:address]
+          addresses << address
         else
         else
-          yield interface[:address]
+          yield address
         end
       end
 
       addresses
     end
 
         end
       end
 
       addresses
     end
 
-    def internal_ipaddress
-      ipaddresses(:role => :internal).first
+    def internal_ipaddress(options = {})
+      ipaddresses(options.merge(:role => :internal)).first
     end
 
     end
 
-    def external_ipaddress
-      ipaddresses(:role => :external).first
+    def external_ipaddress(options = {})
+      ipaddresses(options.merge(:role => :external)).first
     end
   end
 end
     end
   end
 end