Chapter 09/circuit-oneops-1-master/components/cookbooks/kubernetes/libraries/network.rb
def address_for(interface, family = 'inet')
    interface_node = node['network']['interfaces'][interface]['addresses']
    fail "Interface #{interface} has no addresses assigned" if interface_node.to_a.empty?

    address = interface_node.find { |_addr, data| data['family'] == family }
    fail "Interface #{interface} has no address for family #{family}" if address.nil?

    address[0]
  end
# rubocop:disable Documentation
# return the IPv4 (default) address of the given interface.
#
# @param [String] interface The interface to query.
# @param [String] family The protocol family to use.
# @return [String] The address or log error when address is nil
disable Documentation
return the IPv4 (default) address of the given interface.
disable Documentation return the IPv4 ( default ) address of the given interface .
def address_for(interface, family = 'inet')
    interface_node = node['network']['interfaces'][interface]['addresses']
    fail "Interface #{interface} has no addresses assigned" if interface_node.to_a.empty?
    address = interface_node.find { |_addr, data| data['family'] == family }
    fail "Interface #{interface} has no address for family #{family}" if address.nil?
    address[0]
  end
def address_for ( interface , family = 'inet' ) interface_node = node [ 'network' ] [ 'interfaces' ] [ interface ] [ 'addresses' ] fail "Interface #{interface} has no addresses assigned" if interface_node . to_a . empty? address = interface_node . find { | _addr , data | data [ 'family' ] == family } fail "Interface #{interface} has no address for family #{family}" if address . nil? address [ 0 ] end
rubocop:disable Documentation
return the IPv4 (default) address of the given interface.
rubocop : disable Documentation return the IPv4 ( default ) address of the given interface .
The address or log error when address is nil
The address or log error when address is nil
String
interface
family
family The protocol family to use.
family The protocol family to use .