Module: Chef::Sugar::IP
Instance Method Summary collapse
-
#best_ip_for(node, other) ⇒ Object
The best IP address for the given node, in the context of the current node.
Instance Method Details
#best_ip_for(node, other) ⇒ Object
The best IP address for the given node, in the context of the current node. Useful for choosing a local IP address over a public one to limit bandwidth on cloud providers.
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/chef/sugar/ip.rb', line 30 def best_ip_for(node, other) if other['cloud'] if node['cloud'] && other['cloud']['provider'] == node['cloud']['provider'] other['cloud']['local_ipv4'] else other['cloud']['public_ipv4'] end else other['ipaddress'] end end |