Compare commits

..

No commits in common. "master" and "improve-configuration-file" have entirely different histories.

View file

@ -42,7 +42,7 @@ template_originv6 = "@ IN AAAA {ipv6}"
template_ns = "@ IN NS {target}." template_ns = "@ IN NS {target}."
template_mx = "@ IN MX {priority} {target}." template_mx = "@ IN MX {priority} {target}."
template_txt = "{field1} IN TXT {field2}" template_txt = "{field1} IN TXT {field2}"
template_srv = "{service}._{protocole}.{zone}. {ttl} IN SRV {priority} {weight} {port} {target}" template_srv = "_{service}._{protocole}.{zone}. {ttl} IN SRV {priority} {weight} {port} {target}"
template_a = "{hostname} IN A {ipv4}" template_a = "{hostname} IN A {ipv4}"
template_aaaa = "{hostname} IN AAAA {ipv6}" template_aaaa = "{hostname} IN AAAA {ipv6}"
template_cname = "{hostname} IN CNAME {alias}." template_cname = "{hostname} IN CNAME {alias}."
@ -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 and ip['active'] if x['ipv6'] is not None
) )
cname_records = "\n".join( cname_records = "\n".join(
@ -346,12 +346,13 @@ 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 and host['hostname'] for host in zone['ptr_records'] if host['ipv4'] in subnet
) )
zone_file_content = template_reverse.format( zone_file_content = template_reverse.format(
soa=soa, soa=soa,
@ -387,7 +388,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'] if ip['active'] for host in zone['ptr_v6_records'] for ip in host['ipv6']
) )
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