Commit 3ddba1e9 authored by Morten Knutsen's avatar Morten Knutsen

Find reverse IPv4 zone in a more general fashion, allowing updates in more than one zone.

parent 0da8662c
......@@ -169,13 +169,14 @@ class PowerRESTClient(object):
ptr_record['content'] = generate_ptr(ipaddress)
def get_reverse_domain_id(self, v6):
def get_reverse_domain_id(self, v6, record):
if v6:
domain_id = self.get_domain_id("")
if domain_id:
return domain_id
domain_id = self.get_domain_id("")
zone = '.'.join(record.split('.')[1:])
domain_id = self.get_domain_id("{}".format(zone))
if domain_id:
return domain_id
......@@ -186,11 +187,13 @@ class PowerRESTClient(object):
raise RuntimeError("Missing address when trying to create reverse")
rec = self.get_ptr_record(address, ipv6)
if not rec: # Create
domain_id = self.get_reverse_domain_id(ipv6)
if ipv6:
reverse_record = reverse_dns6(address)
reverse_record = reverse_dns(address)
domain_id = self.get_reverse_domain_id(ipv6, reverse_record)
data = {'content': ptr,
'name': reverse_record,
'domain_id': domain_id,
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment