ignore ipv6 with the 'active' field set to false

This commit is contained in:
Jean-Marie Mineau 2020-08-04 22:25:05 +02:00 committed by root
parent 0d82a4cf99
commit f8a7c1b580

View file

@ -203,7 +203,7 @@ def write_dns_file(zone, verbose=False):
) )
for x in zone['aaaa_records'] for x in zone['aaaa_records']
for ip in x['ipv6'] for ip in x['ipv6']
if x['ipv6'] is not None if x['ipv6'] is not None and ip['active']
) )
cname_records = "\n".join( cname_records = "\n".join(
@ -346,13 +346,12 @@ def write_dns_reverse_file(api_client):
expire=zone['soa']['expire'], expire=zone['soa']['expire'],
ttl=zone['soa']['ttl'] ttl=zone['soa']['ttl']
) )
ptr_records = "\n".join( ptr_records = "\n".join(
template_ptr.format( template_ptr.format(
hostname=host['hostname']+extension, hostname=host['hostname']+extension,
target=get_ip_reverse(host['ipv4'],prefix_length) target=get_ip_reverse(host['ipv4'],prefix_length)
) )
for host in zone['ptr_records'] if host['ipv4'] in subnet for host in zone['ptr_records'] if host['ipv4'] in subnet and host['hostname']
) )
zone_file_content = template_reverse.format( zone_file_content = template_reverse.format(
soa=soa, soa=soa,
@ -388,7 +387,7 @@ def write_dns_reverse_file(api_client):
ptr_records = "\n".join( ptr_records = "\n".join(
template_ptr.format(hostname=host['hostname']+extension, template_ptr.format(hostname=host['hostname']+extension,
target=get_ip_reverse(ip['ipv6'],prefix_length)) target=get_ip_reverse(ip['ipv6'],prefix_length))
for host in zone['ptr_v6_records'] for ip in host['ipv6'] for host in zone['ptr_v6_records'] for ip in host['ipv6'] if ip['active']
) )
if zone6_name in zone_v6: if zone6_name in zone_v6:
# we already created the file, we ignore the soa # we already created the file, we ignore the soa