no generation if no ptr record
This commit is contained in:
parent
a0b93b94e0
commit
fee0f35f45
1 changed files with 84 additions and 82 deletions
8
main.py
8
main.py
|
@ -148,7 +148,7 @@ def write_dns_files(api_client):
|
|||
aaaa_records=aaaa_records,
|
||||
cname_records=cname_records)
|
||||
|
||||
filename = 'dns.{zone}.zone'.format(zone=zone_name)
|
||||
filename = 'generated/dns.{zone}.zone'.format(zone=zone_name)
|
||||
with open(filename, 'w+') as f:
|
||||
f.write(zone_file_content)
|
||||
|
||||
|
@ -198,6 +198,7 @@ def write_dns_reverse_file(api_client):
|
|||
|
||||
# For the ipv4, we need to agregate the subnets together, because
|
||||
# we can only have reverse for /24, /16 and /8.
|
||||
if zone['ptr_records']:
|
||||
subnets = []
|
||||
for net in zone['cidrs']:
|
||||
net = netaddr.IPNetwork(net)
|
||||
|
@ -247,6 +248,7 @@ def write_dns_reverse_file(api_client):
|
|||
|
||||
|
||||
### Continue with the ipv6 reverse
|
||||
if zone['ptr_v6_records']:
|
||||
net = netaddr.IPNetwork(zone['prefix_v6']+"/"+str(zone['prefix_v6_length']))
|
||||
net_class = max(((net.prefixlen - 1) // 4) + 1, 1)
|
||||
zone6_name = ".".join(
|
||||
|
@ -296,10 +298,10 @@ api_client = Re2oAPIClient(api_hostname, api_username, api_password)
|
|||
|
||||
client_hostname = socket.gethostname().split('.', 1)[0]
|
||||
|
||||
for service in api_client.list("services/regen/"):
|
||||
#for service in api_client.list("services/regen/"):
|
||||
# if service['hostname'] == client_hostname and \
|
||||
# service['service_name'] == 'dns' and \
|
||||
# service['need_regen']:
|
||||
#write_dns_files(api_client)
|
||||
write_dns_files(api_client)
|
||||
write_dns_reverse_file(api_client)
|
||||
# api_client.patch(service['api_url'], data={'need_regen': False})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue