Compare commits
4 commits
improve-co
...
master
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f8a7c1b580 | ||
![]() |
0d82a4cf99 | ||
![]() |
6710dfde1b | ||
![]() |
969afb1160 |
1 changed files with 4 additions and 5 deletions
9
main.py
9
main.py
|
@ -42,7 +42,7 @@ template_originv6 = "@ IN AAAA {ipv6}"
|
|||
template_ns = "@ IN NS {target}."
|
||||
template_mx = "@ IN MX {priority} {target}."
|
||||
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_aaaa = "{hostname} IN AAAA {ipv6}"
|
||||
template_cname = "{hostname} IN CNAME {alias}."
|
||||
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue