def ip_fqdn():
 if salt.utils.is_proxy():
  return {}
 ret = {}
 ret['ipv4'] = salt.utils.network.ip_addrs(include_loopback=True)
 ret['ipv6'] = salt.utils.network.ip_addrs6(include_loopback=True)
 _fqdn = hostname()['fqdn']
 for (socket_type, ipv_num) in ((socket.AF_INET, '4'), (socket.AF_INET6, '6')):
  key = ('fqdn_ip' + ipv_num)
  if (not ret[('ipv' + ipv_num)]):
   ret[key] = []
  else:
   try:
    info = socket.getaddrinfo(_fqdn, None, socket_type)
    ret[key] = list(set((item[4][0] for item in info)))
   except socket.error:
    ret[key] = []
 return ret

def ip_fqdn ( ) : if salt . utils . is_proxy ( ) : return { } ret = { } ret [ 'ipv4' ] = salt . utils . network . ip_addrs ( include_loopback = True ) ret [ 'ipv6' ] = salt . utils . network . ip_addrs6 ( include_loopback = True ) _fqdn = hostname ( ) [ 'fqdn' ] for ( socket_type , ipv_num ) in ( ( socket . AF_INET , '4' ) , ( socket . AF_INET6 , '6' ) ) : key = ( 'fqdn_ip' + ipv_num ) if ( not ret [ ( 'ipv' + ipv_num ) ] ) : ret [ key ] = [ ] else : try : info = socket . getaddrinfo ( _fqdn , None , socket_type ) ret [ key ] = list ( set ( ( item [ 4 ] [ 0 ] for item in info ) ) ) except socket . error : ret [ key ] = [ ] return ret
return ip address and fqdn grains .