diff --git a/main.py b/main.py index dc6f753..b7941ab 100755 --- a/main.py +++ b/main.py @@ -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(