]> git.openstreetmap.org Git - chef.git/blob - cookbooks/networking/libraries/ipaddresses.rb
Fix some rubocop detected style issues
[chef.git] / cookbooks / networking / libraries / ipaddresses.rb
1 class Chef
2   class Node
3     def ipaddresses(options = {}, &block)
4       addresses = []
5
6       interfaces(options).each do |interface|
7         if block.nil?
8           addresses << interface[:address]
9         else
10           block.call(interface[:address])
11         end
12       end
13
14       addresses
15     end
16
17     def internal_ipaddress
18       ipaddresses(:role => :internal).first
19     end
20
21     def external_ipaddress
22       ipaddresses(:role => :external).first
23     end
24   end
25 end