X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/faf8ae12e85eabb050b0f5eceb2cb67ad1de5261..9de17ece169e2c0f91c5545b328fc0cc2fc6a0f4:/cookbooks/networking/libraries/ipaddresses.rb?ds=sidebyside diff --git a/cookbooks/networking/libraries/ipaddresses.rb b/cookbooks/networking/libraries/ipaddresses.rb index 811c81884..d31d885f9 100644 --- a/cookbooks/networking/libraries/ipaddresses.rb +++ b/cookbooks/networking/libraries/ipaddresses.rb @@ -4,10 +4,12 @@ class Chef addresses = [] interfaces(options).each do |interface| + address = interface[:public_address] || interface[:address] + if block.nil? - addresses << interface[:address] + addresses << address else - block.call(interface[:address]) + yield address end end @@ -15,11 +17,11 @@ class Chef end def internal_ipaddress - return ipaddresses(:role => :internal).first + ipaddresses(:role => :internal).first end def external_ipaddress - return ipaddresses(:role => :external).first + ipaddresses(:role => :external).first end end end