def NS(domain, resolve=True, nameserver=None):
 dig = ['dig', '+short', str(domain), 'NS']
 if (nameserver is not None):
  dig.append('@{0}'.format(nameserver))
 cmd = __salt__['cmd.run_all'](dig, python_shell=False)
 if (cmd['retcode'] != 0):
  log.warning("dig returned exit code '{0}'. Returning empty list as fallback.".format(cmd['retcode']))
  return []
 if resolve:
  ret = []
  for ns_host in cmd['stdout'].split('\n'):
   for ip_addr in A(ns_host, nameserver):
    ret.append(ip_addr)
  return ret
 return cmd['stdout'].split('\n')

def NS ( domain , resolve = True , nameserver = None ) : dig = [ 'dig' , '+short' , str ( domain ) , 'NS' ] if ( nameserver is not None ) : dig . append ( '@{0}' . format ( nameserver ) ) cmd = __salt__ [ 'cmd.run_all' ] ( dig , python_shell = False ) if ( cmd [ 'retcode' ] != 0 ) : log . warning ( "dig returned exit code '{0}'. Returning empty list as fallback." . format ( cmd [ 'retcode' ] ) ) return [ ] if resolve : ret = [ ] for ns_host in cmd [ 'stdout' ] . split ( '\n' ) : for ip_addr in A ( ns_host , nameserver ) : ret . append ( ip_addr ) return ret return cmd [ 'stdout' ] . split ( '\n' )
return a list of ips of the nameservers for domain if resolve is false .