support mutiple ipv6, and no origin v4

This commit is contained in:
Charlie Jacomme 2018-06-27 18:34:03 +02:00
parent d321aeb2ea
commit be31f657f6

11
main.py
View file

@ -76,7 +76,10 @@ def write_dns_files(api_client):
expire=zone['soa']['expire'],
ttl=zone['soa']['ttl'])
originv4 = template_originv4.format(ipv4=zone['originv4']['ipv4'])
if zone['originv4'] is not None:
originv4 = template_originv4.format(ipv4=zone['originv4']['ipv4'])
else:
originv4 = ""
if zone['originv6'] is not None:
originv6 = template_originv6.format(ipv6=zone['originv6'])
else:
@ -119,8 +122,10 @@ def write_dns_files(api_client):
aaaa_records = "\n".join(
template_aaaa.format(hostname=x['hostname'],
ipv6=x['ipv6'])
for x in zone['aaaa_records'] if x['ipv6'] is not None
ipv6=ip['ipv6'])
for x in zone['aaaa_records']
for ip in x['ipv6']
if x['ipv6'] is not None
)
cname_records = "\n".join(