bin/pvl.hosts-dns
changeset 296 9dad6914cfe7
parent 289 b316deddf746
child 298 fa1ab8cda47e
equal deleted inserted replaced
295:8c6d4565576f 296:9dad6914cfe7
    22         elif pvl.dns.zone.join('*', host.domain) == domain :
    22         elif pvl.dns.zone.join('*', host.domain) == domain :
    23             pass
    23             pass
    24         elif fnmatch.fnmatch(host.domain, domain) :
    24         elif fnmatch.fnmatch(host.domain, domain) :
    25             pass
    25             pass
    26         else :
    26         else :
       
    27             log.debug("%s: %s out of domain: %s", host, host.domain, domain)
    27             continue
    28             continue
    28         
    29         
    29         if host.ip :
    30         if host.ip :
    30             yield pvl.dns.zone.ZoneRecord.A(host, host.ip)
    31             yield pvl.dns.zone.ZoneRecord.A(host, host.ip)
    31         
    32         
    60             ip = host.ip6
    61             ip = host.ip6
    61         else :
    62         else :
    62             raise ValueError("%s: unknown ip version: %s" % (prefix, prefix.version))
    63             raise ValueError("%s: unknown ip version: %s" % (prefix, prefix.version))
    63 
    64 
    64         if not ip :
    65         if not ip :
       
    66             log.debug("%s: no ip%d", host, prefix.version)
    65             continue
    67             continue
    66 
    68 
    67         if ip not in prefix :
    69         if ip not in prefix :
       
    70             log.debug("%s: %s out of prefix: %s", host, ip, prefix)
    68             continue
    71             continue
       
    72         
       
    73         fqdn = pvl.dns.zone.fqdn(host, host.domain)
    69 
    74 
    70         yield ip, pvl.dns.zone.fqdn(host, host.domain)
    75         log.debug("%s: ip=%s domain=%s: %s", host, ip, host.domain, fqdn)
       
    76 
       
    77         yield ip, fqdn
    71  
    78  
    72 def process_hosts_reverse (options, hosts, prefix) :
    79 def process_hosts_reverse (options, hosts, prefix) :
    73     """
    80     """
    74         Generate DNS ZoneRecords within the given prefix's reverse-dns zone for hosts.
    81         Generate DNS ZoneRecords within the given prefix's reverse-dns zone for hosts.
    75     """
    82     """