From f8a7c1b580b248d488b2c584c8568deff6637355 Mon Sep 17 00:00:00 2001 From: Jean-Marie Mineau Date: Tue, 4 Aug 2020 22:25:05 +0200 Subject: [PATCH] ignore ipv6 with the 'active' field set to false --- main.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 550ceee..0673d6c 100755 --- a/main.py +++ b/main.py @@ -203,7 +203,7 @@ def write_dns_file(zone, verbose=False): ) for x in zone['aaaa_records'] for ip in x['ipv6'] - if x['ipv6'] is not None + if x['ipv6'] is not None and ip['active'] ) cname_records = "\n".join( @@ -346,13 +346,12 @@ def write_dns_reverse_file(api_client): expire=zone['soa']['expire'], ttl=zone['soa']['ttl'] ) - ptr_records = "\n".join( template_ptr.format( hostname=host['hostname']+extension, 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( soa=soa, @@ -388,7 +387,7 @@ def write_dns_reverse_file(api_client): ptr_records = "\n".join( template_ptr.format(hostname=host['hostname']+extension, 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: # we already created the file, we ignore the soa